[R] Color Nodes

Jeff Reichman re|chm@nj @end|ng |rom @bcg|ob@|@net
Wed Oct 26 22:37:09 CEST 2022



For those of you who use igraph is there a way to highlight (color)
particular notes. For example if I want to color the "Peter" node red and
everything else blue  or leave default) how would I do that or can I do
that. Seems as though I might create an attribute column - maybe??






# define links in data

edges <- rbind(c("Dave", "Jenny"), c("Peter", "Jenny"), c("John", "Jenny"),
c("Dave", "Peter"), c("Dave", "John"), c("Peter", "Sam"), c("Sam",
"Albert"), c("Peter", "John"))


# generate and plot graph

# set argument directed = FALSE in graph.edgelist() to plot an undirected

g <- graph.edgelist(edges, directed = FALSE)

plot(g, vertex.size = 1, vertex.label.dist = 0.5)

	[[alternative HTML version deleted]]

More information about the R-help mailing list