causaldag.classes.dag.DAG.shd_skeleton¶
-
DAG.
shd_skeleton
(other) → int[source]¶ Compute the structure Hamming distance between the skeleton of this DAG and the skeleton of the graph
other
.Parameters: other – the DAG to which the SHD of the skeleton will be computed. Returns: The structural Hamming distance between and is the minimum number of arc additions, deletions, and reversals required to transform into (and vice versa). Return type: int Example
>>> import causaldag as cd >>> g1 = cd.DAG(arcs={(1, 2), (2, 3)}) >>> g2 = cd.DAG(arcs={(2, 1), (2, 3)}) >>> g1.shd_skeleton(g2) 0
>>> g1 = cd.DAG(arcs={(1, 2)}) >>> g2 = cd.DAG(arcs={(1, 2), (2, 3)}) >>> g1.shd_skeleton(g2) 1