Is there a possibility to rename the vertices in an igraph. I want to plot a certain graph multiple times with different notation on the vertices. Given the following igraph
You can use
ay <- set.vertex.attribute(az, "name", value=paste("y",1:27,sep=""))
Also works with "label"
instead of "name"
.
If V(az) has both a set of 'name' attributes and a set of 'label' attributes, it is the 'label' attributes that get plotted.
> gt <- graph.tree(24, children = 4, mode=c("out", "in", "undirected"))
> V(gt)$name <- letters[1:24]
> plot(gt) # So 'name's get displayed if no label is present
> V(gt)$label <- LETTERS[1:24]
> plot(gt) # Labels get displayed
> V(gt)$name <- letters[1:24] # see if then get overwritten
> plot(gt) # Still plots with 'label's