graphical_models.classes.dags.dag.DAG.shd
- DAG.shd(other) int [source]
Compute the structural Hamming distance between this DAG and the DAG
other
.- Parameters
other – the DAG to which the SHD 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
>>> from graphical_models import DAG >>> g1 = DAG(arcs={(1, 2), (2, 3)}) >>> g2 = DAG(arcs={(2, 1), (2, 3)}) >>> g1.shd(g2) 1