g <- graphNEL(nodes=c("a", "b", "c"),
edgeL=list(a=c("b", "c"), b=character(0), c=character(0)),
edgemode="directed")
stopifnot(isAdjacent(g, "a", "b"))
stopifnot(!isAdjacent(g, "b", "a"))
grev <- reverseEdgeDirections(g)
stopifnot(!isAdjacent(grev, "a", "b"))
stopifnot(isAdjacent(grev, "b", "a"))
Run the code above in your browser using DataLab