Skip to main content

root_nodes

Function root_nodes 

Source
pub fn root_nodes(graph: &BiAdjacentGraph) -> SortedIntView<'static>
Expand description

Returns the root nodes of graph in ascending order. A root node has in-degree 0.

A traversal of a DAG or a forest starts from them, as in traverser.run_from_nodes(&graphs::root_nodes(&graph), &mut hooks) with a DfsTraverser. BiAdjacentGraph::is_root_node checks a single node in O(1).

Time: O(node_count). Memory: 4 bytes per root node for the result.