graph.levels: Build graph levels

Description Usage Arguments Value Examples

View source: R/graph.utility.R

Description

Group a set of nodes in according to their maximum depth in the graph. Firstly, it inverts the weights of the graph and then it applies the Bellman Ford algorithm to find the shortest path, achieving in this way the longest path.

Usage

1
graph.levels(g, root = "00")

Arguments

g

an object of class graphNEL.

root

name of the class that it is on the top-level of the hierarchy (def. root="00").

Value

A list of the nodes grouped w.r.t. the distance from the root: the first element of the list corresponds to the root node (level 0), the second to nodes at maximum distance 1 (level 1), the third to the node at maximum distance 3 (level 2) and so on.

Examples

1
2
3
data(graph);
root <- root.node(g);
lev <- graph.levels(g, root=root);

HEMDAG documentation built on Feb. 12, 2021, 5:13 p.m.