Learn R Programming

HEMDAG (version 2.6.1)

graph.levels: Build Graph Levels

Description

This function groups a set of nodes in according to their maximum depth in the graph. It first inverts the weights of the graph and then applies the Bellman Ford algorithm to find the shortest path, achieving in this way the longest path.

Usage

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

Arguments

g

an object of class graphNEL

root

name of the root node (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

Run this code
# NOT RUN {
data(graph);
root <- root.node(g);
lev <- graph.levels(g, root=root);
# }

Run the code above in your browser using DataLab