Remove cycles and bidirected edges from a directed graph.
graph2dag(graph, data, bap = FALSE, time.limit = Inf, ...)
A directed graph as an igraph object.
A data matrix with subjects as rows and variables as columns.
If TRUE, a bow-free acyclic path (BAP) is returned (default = FALSE).
CPU time for the computation, in seconds (default = Inf).
Currently ignored.
A DAG as an igraph object.
The conversion is performed firstly by removing bidirected
edges and then the data matrix is used to compute edge P-values, through
marginal correlation testing (see weightGraph
,
r-to-z method). When a cycle is detected, the edge with highest
P-value is removed, breaking the cycle. If the bap argument is TRUE,
a BAP is generated merging the output DAG and the bidirected edges
from the input graph.