I need to color nodes differently to plot graph communities (set of nodes) in R. For this case, I deal with 17 communities ( so I need 17 different color). to color nodes I use this command.
V(g5)$color<- ifelse(V(g5)$name %in% V(g3)$name,com$membership+1, "white")
com$membership
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 6 6 6 6 6 6 6 6 7 7 8 8 8 8 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 11 11 11 11 11 11 12 12 13 13 13 13 14 14 14 14 15 15 15 15 16 17 17 9 14
and to plot :
plot(g5, vertex.color=V(g5)$name)
the problem that i get only 6 color that it repeat to the other communities. How can i correctly color this 17 communities differently?