Entering edit mode
transitive.reduction
in nem does not always return the transitive reduction unless one applies transitive.reduction
on the transitive closure of the graph. So I think that either the code should be fixed (by using transitive.closure
first) or the documentation fixed (but this second route seems dangerous for those who do not read the help carefully). This bug will probably also affect rBiopaxParser (its transitiveReduction function).
Examples below taken from discussion and comments in http://stackoverflow.com/a/6702198 as well as comments to http://stackoverflow.com/a/2372202
library(nem) m1 <- matrix(0, nrow = 4, ncol = 4) colnames(m1) <- rownames(m1) <- LETTERS[1:4] m1[rbind(c(1, 2), c(2, 3), c(3, 4), c(1, 4))] <- 1 ## Wrong, since A connected to D directly and through B-> C nem::transitive.reduction(m1) ## OK nem::transitive.reduction(transitive.closure(m1))m2 <- matrix(0, nrow = 4, ncol = 4) colnames(m2) <- rownames(m2) <- LETTERS[1:4] m2[rbind(c(1, 2), c(2, 3), c(3, 4), c(1, 3), c(1, 4))] <- 1
## Wrong, since A connected to D directly and through B-> C nem::transitive.reduction(m2) ## OK nem::transitive.reduction(transitive.closure(m2))
Dear Ramon,
as you noticed rBiopaxParser uses the transitive reduction function implemented in package nem.
Holger Fröhlich (package maintainer) mentioned that a bug fix for this should be supplied with the next nem version.
Best wishes,
Frank