build.ancestors {HEMDAG} | R Documentation |
Build ancestors
Description
Build ancestors for each node of a graph.
Usage
build.ancestors(g)
build.ancestors.per.level(g, levels)
build.ancestors.bottom.up(g, levels)
Arguments
g |
a graph of class |
levels |
a list of character vectors. Each component represents a graph level and the elements of any component correspond to nodes. The level 0 coincides with the root node. |
Value
build.ancestos
returns a named list of vectors. Each component corresponds to a node of the graph and its vector
is the set of its ancestors including also
.
build.ancestors.per.level
returns a named list of vectors. Each component corresponds to a node
of the graph and its vector is the set of its ancestors including also
. The nodes are ordered from root (included) to leaves.
build.ancestors.bottom.up
a named list of vectors. Each component corresponds to a node of the
graph and its vector is the set of its ancestors including also
. The nodes are ordered from leaves to root (included).
Examples
data(graph);
root <- root.node(g);
anc <- build.ancestors(g);
lev <- graph.levels(g, root=root);
anc.tod <-build.ancestors.per.level(g,lev);
anc.bup <- build.ancestors.bottom.up(g,lev);