BayesNetFragment.topologicalOrder
- BayesNetFragment.topologicalOrder()
- Returns:
the list of the nodes Ids in a topological order
- Return type:
List- Raises:
pyagrum.InvalidDirectedCycle – If this graph contains cycles
Example
import pyagrum as gum
bn = gum.fastBN("A->B->C<-D;C->E")
fragment = gum.BayesNetFragment(bn)
fragment.installAscendants("C") # A, B, C, D
fragment.topologicalOrder()
# [3, 0, 1, 2]
Class