graphical_models.classes.dags.dag.DAG.permutation_score

DAG.permutation_score(order: list) int[source]

Return the number of “errors” in order with respect to the DAG, i.e., the number of times that i->``j`` in the DAG but i comes after j in order.

Parameters

order – the order to check.

Examples

>>> from graphical_models import DAG
>>> g = DAG(arcs={(1, 2), (1, 3)})
>>> g.permutation_score([1, 2, 3])
0
>>> g.permutation_score([2, 1, 3])
1
>>> g.permutation_score([2, 3, 1])
2