Warning
This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
topological_sort_recursive¶
- topological_sort_recursive(G, nbunch=None, reverse=False)[source]¶
Return a list of nodes in topological sort order.
A topological sort is a nonunique permutation of the nodes such that an edge from u to v implies that u appears before v in the topological sort order.
Parameters : G : NetworkX digraph
nbunch : container of nodes (optional)
Explore graph in specified order given in nbunch
reverse : bool, optional
Return postorder instead of preorder if True. Reverse mode is a bit more efficient.
Raises : NetworkXError
Topological sort is defined for directed graphs only. If the graph G is undirected, a NetworkXError is raised.
NetworkXUnfeasible
If G is not a directed acyclic graph (DAG) no topological sort exists and a NetworkXUnfeasible exception is raised.
See also
Notes
This is a recursive version of topological sort.