Function petgraph::algo::toposort [] [src]

pub fn toposort<G>(g: G, space: Option<&mut DfsSpace<G::NodeId, G::Map>>) -> Vec<G::NodeId> where G: IntoNodeIdentifiers + IntoNeighborsDirected + IntoExternals + Visitable

[Generic] Perform a topological sort of a directed graph.

Return a vector of nodes in topological order: each node is ordered before its successors.

NOTE: If the returned vec contains less than all the nodes of the graph, then the graph had a cycle.

If space is not None, it is reused instead of creating a temporary workspace for graph traversal.