Note

This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.

rustworkx.topological_sort#

topological_sort(graph, /)#

Return the topological sort of node indices from the provided graph

Parameters:

graph (PyDiGraph) – The DAG to get the topological sort on

Returns:

A list of node indices topologically sorted.

Return type:

NodeIndices

Raises:

DAGHasCycle – if a cycle is encountered while sorting the graph