StructuralMetrics.shd
- StructuralMetrics.shd()
Structural Hamming Distance: number of arc/edge insertions, deletions and reversals needed to transform the test graph into the ref graph.
- Returns:
SHD (non-negative integer returned as float).
- Return type:
float
Example
import pyagrum as gum
ref = gum.fastDAG("A->B->C;A->D")
test = gum.fastDAG("A->B;C->B;A->D") # B->C is reversed
sm = gum.StructuralMetrics()
sm.compare(ref, test)
sm.shd() # one reversal
# 1.0
Class