DiGraph.topologicalOrder

DiGraph.topologicalOrder()
Returns:

the list of the nodes Ids in a topological order

Return type:

List

Raises:

pyagrum.InvalidDirectedCycle – If this graph contains cycles

See also

pyagrum.graph.topologicalOrder

the same for every graph with arcs

Example

import pyagrum as gum

g = gum.fastDiGraph("C->B->A;C->A")
[g.nameFromId(i) for i in g.topologicalOrder()]
# ['C', 'B', 'A']

Used by

DiGraph, ChainGraph, DAG, MixedGraph, PDAG

Inheritance diagram of pyagrum.DiGraph, pyagrum.ChainGraph, pyagrum.DAG, pyagrum.MixedGraph, pyagrum.PDAG