causaldag.classes.dag.DAG.chickering_distance

DAG.chickering_distance(other) → int[source]

Return the total number of edge reversals plus twice the number of edge additions/deletions required to turn this DAG into the DAG other.

Parameters:other – the DAG against which to compare the Chickering distance.
Returns:The Chickering distance between this DAG and the DAG other.
Return type:int

Examples

>>> import causaldag as cd
>>> d1 = cd.DAG(arcs={(0, 1), (1, 2)})
>>> d2 = cd.DAG(arcs={(0, 1), (2, 1), (3, 1)})
>>> d1.chickering_distance(d2)
3