removeEdge: removeEdge

Description Usage Arguments Details Value Author(s) See Also Examples

Description

A function to remove the specified edges from a graph.

Usage

1
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

addNode,addEdge,removeNode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  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)

Example output

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

graph documentation built on Nov. 8, 2020, 6:02 p.m.