parent: Parent of a node

Description Usage Arguments Value Examples

Description

The function parent returns the parent of a node in a given tree. If the node is not found in the tree or has no parent, the empty tree is returned.

Usage

1
2
3
4
5
6
parent(.node, .tree, degree = 1L)

## S3 method for class 'rtree'
parent(.node, .tree, degree = 1L)

has.parent(.node, .tree)

Arguments

.node

node or character. The node or node label considered.

.tree

A tree.

degree

integer. Currently not used.

Value

A node.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Rooted tree
(tr0 = c_("Bob", "Carl", "Daniel"))
(tr1 = c_("Bill", "Caroline", "Dimitri", "Enoc"))
(tr2 = r_("Alice", s = list(tr0, tr1)))

## Unrooted tree
(tr3 = r_(s = list(tr2, c_("Son", "Father", "Grand-Mother"))))
parent("Alice", tr3)
parent("Bob", tr3)
parent("any node", tr3)

oak documentation built on May 1, 2019, 9:13 p.m.

Related to parent in oak...