graph2dag | R Documentation |
Remove cycles and bidirected edges from a directed graph.
graph2dag(graph, data, bap = FALSE, time.limit = Inf, ...)
graph |
A directed graph as an igraph object. |
data |
A data matrix with subjects as rows and variables as columns. |
bap |
If TRUE, a bow-free acyclic path (BAP) is returned (default = FALSE). |
time.limit |
CPU time for the computation, in seconds (default = Inf). |
... |
Currently ignored. |
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.
A DAG as an igraph object.
Mario Grassi mario.grassi@unipv.it
dag <- graph2dag(graph = sachs$graph, data = log(sachs$pkc))
old.par <- par(no.readonly = TRUE)
par(mfrow=c(1,2), mar=rep(1, 4))
gplot(sachs$graph, main = "Input graph")
gplot(dag, main = "Output DAG")
par(old.par)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.