removeEdge {graph} | R Documentation |
A function to remove the specified edges from a graph.
removeEdge(from, to, graph)
from |
from edge labels |
to |
to edge labels |
graph |
a graph object |
The edges in the graph from nodes in the from
set to the
to
set are removed and a new graph object returned.
Both from
and to
can be vectors, not necessarily of the
same length (in which case standard rules for replicating the shorter
one apply).
If the graph is undirected
then the undirected edge is removed.
A new instance of a graph with the same class as graph
is
returned. Any of the listed edges in graph
have been removed.
R. Gentleman
V <- LETTERS[1:4] edL1 <- vector("list", length=4) names(edL1) <- V for(i in 1:4) edL1[[i]] <- list(edges=c(2,1,4,3)[i], weights=sqrt(i)) gR <- new("graphNEL", nodes=V, edgeL=edL1) gX <- removeEdge("A", "B", gR)