removeEdge {graph}R Documentation

removeEdge

Description

A function to remove the specified edges from a graph.

Usage

removeEdge(from, to, graph)

Arguments

from from edge labels
to to edge labels
graph a graph object

Details

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.

Value

A new instance of a graph with the same class as graph is returned. Any of the listed edges in graph have been removed.

Author(s)

R. Gentleman

See Also

addNode,addEdge,removeNode,

Examples

  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)

[Package graph version 1.8.0 Index]