transitive.reduction {nem} | R Documentation |
transitive.reduction
removes direct edges, which can be explained by another path in the graph.
transitive.reduction(g)
g |
graphNEL object |
transitive.reduction
uses a modification of the classical algorithm from the Sedgewick book for computing transitive closures.
returns a graph object with shortcuts removed
Holger Froehlich
R. Sedgewick, Algorithms, Pearson, 2002.
V <- LETTERS[1:3] edL <- list(A=list(edges=c("B","C")),B=list(edges="C"),C=list(edges=NULL)) gc <- new("graphNEL",nodes=V,edgeL=edL,edgemode="directed") g <- transitive.reduction(gc) par(mfrow=c(1,2)) plot(gc,main="shortcut A->C") plot(g,main="shortcut removed")