addNode {graph} | R Documentation |
Add a node to a graph.
addNode(node, object)
node |
a character string, or node object |
object |
a graph |
The supplied node is added to the set of nodes of the object
.
A new graph of the same class as object
with the supplied node
added to the set of nodes.
R. Gentleman
removeNode
, removeEdge
,
addEdge
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)