causal_networkx.algorithms.topological_sort#
- causal_networkx.algorithms.topological_sort(G)[source]#
Returns a generator of nodes in topologically sorted order.
A topological sort is a nonunique permutation of the nodes of a directed graph such that an edge from u to v implies that u appears before v in the topological sort order. This ordering is valid only if the graph has no directed cycles.
- Parameters:
G :
ADMG
A causal directed acyclic graph (DAG)
- Yields:
nodes
Yields the nodes in topological sorted order.