Learn R Programming

caugi (version 1.0.0)

shd: Structural Hamming Distance

Description

Compute the Structural Hamming Distance (SHD) between two graphs.

Usage

shd(cg1, cg2, normalized = FALSE)

Value

An integer representing the Hamming Distance between the two graphs, if normalized = FALSE, or a numeric between 0 and 1 if normalized = TRUE.

Arguments

cg1

A caugi object.

cg2

A caugi object.

normalized

Logical; if TRUE, returns the normalized SHD.

See Also

Other metrics: aid(), hd()

Examples

Run this code
cg1 <- caugi(A %-->% B %-->% C, D %-->% C, class = "DAG")
cg2 <- caugi(A %-->% B %-->% C, D %---% C, class = "PDAG")
shd(cg1, cg2) # 1

Run the code above in your browser using DataLab