Skip to main content

Extend a PDAG to a consistent DAG

Source: R/transform.R, R/jlbind-wrappers.R

Description

Orients every undirected edge of the PDAG-family graph cg, using the Dor-Tarsi algorithm. It repeatedly finds a sink node (no directed children, whose undirected neighbors form a clique), orients all its undirected edges toward it, and removes it. Errors if no valid DAG extension exists.

Usage

Arguments

cg A PDAG-family (PDAG, CPDAG, MPDAG) graph created with cgraph().

Value

A cgraph of class DAG.

References

Dor D, Tarsi M (1992). “A simple algorithm to construct a consistent extension of a partially oriented graph.” Technical Report R-185, Cognitive Systems Laboratory, UCLA.

Examples

pdag <- cgraph(A %---% B, B %---% C, class = "PDAG")
dag_from_pdag(pdag)
#> DAG with 3 nodes and 2 edges:
#>   nodes: A, B, C
#>   edges:
#>     A --> B, B --> C