Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

removeEdge

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

A new graph instance is returned with the edges specified by corresponding elements of the from and to vectors removed. If from and to are not the same length, one of them should have length one. All edges to be removed must exist in graph.

Value

A new instance of a graph with the same class as graph is returned with the specified edges removed.

Author(s)

R. Gentleman

See Also

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 <- graphNEL(nodes=V, edgeL=edL1)

  gX <- removeEdge("A", "B", gR)

  set.seed(123)
  g <- randomEGraph(V=letters[1:5],edges=5)
  g2 <- removeEdge(from=c("a","b"), to=c("c","e"), g)

graph

graph: A package to handle graph data structures

v1.68.0
Artistic-2.0
Authors
R. Gentleman, Elizabeth Whalen, W. Huber, S. Falcon
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.