graphical_models.classes.mags.ancestral_graph.AncestralGraph.topological_sort
- AncestralGraph.topological_sort() list [source]
Return a linear order that is consistent with the partial order implied by ancestral relations of this graph.
Examples
>>> from graphical_models import AncestralGraph >>> g = AncestralGraph(bidirected={(1, 2), (1, 4)}, directed={(1, 3), (2, 3)}) >>> g.topological_sort() [4, 2, 1, 3]