g2dag | R Documentation |
Converts a general graph to a dag with minimum distance to the original graph. The general idea is to transitively close the graph to detect cycles and remove them based on the rule "the more outgoing edges a node has, the more likely it is that incoming edges from a cycle will be deleted, and vice versa. However, this is too rigorous and deletes too many edges, which do not lead to a cycle. These edges are added back in the final step.
g2dag(g, tc = FALSE)
g |
graph as adjacency matrix |
tc |
if TRUE computes the transitive closure |
dag as adjacency matrix
Ken Adams
g <- matrix(c(1,0,1,0, 1,1,0,0, 0,1,1,0, 1,1,0,1), 4, 4) rownames(g) <- colnames(g) <- LETTERS[seq_len(4)] dag <- g2dag(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.