pub fn toposort<G>( g: G, space: Option<&mut DfsSpace<<G as GraphBase>::NodeId, <G as Visitable>::Map>> ) -> Result<Vec<<G as GraphBase>::NodeId, Global>, Cycle<<G as GraphBase>::NodeId>>where G: IntoNeighborsDirected + IntoNodeIdentifiers + Visitable,
[Generic] Perform a topological sort of a directed graph.
If the graph was acyclic, return a vector of nodes in topological order:
each node is ordered before its successors.
Otherwise, it will return a
Cycle error. Self loops are also cycles.
To handle graphs with cycles, use the scc algorithms or
instead of this function.
space is not
None, it is used instead of creating a new workspace for
graph traversal. The implementation is iterative.