addNode {graph}R Documentation

addNode

Description

Add a node to a graph.

Usage

addNode(node, object)

Arguments

node a character string, or node object
object a graph

Details

The supplied node is added to the set of nodes of the object.

Value

A new graph of the same class as object with the supplied node added to the set of nodes.

Author(s)

R. Gentleman

See Also

removeNode, removeEdge, addEdge

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 <- addNode("X", gR)

[Package Contents]