Help with coloring nodes and edges in Igraph

I need help coloring the nodes of an Igraph network.
At the moment, it looks something like this:


I want every single node to be colored individually. And For this I want all edges that leave a node to be colored in exactly the same color.

At the moment the code looks like this:

NEWC0 ← as.matrix(NEWC0)
gnewc0 ← graph_from_adjacency_matrix(NEWC0, mode=c(“directed”), weighted=TRUE, diag=FALSE, add.colnames=NULL, add.rownames=NA)
E(gnewc0)$width ← E(gnewc0)$weight /5
plot(gnewc0, vertex.color = “blue”, vertex.frame.color = “black”, vertex.label.cex = 0.9, vertex.label.color = “black”, vertex.label.distance = 200, vertex.label.font = 1, edge.arrow.size = 0.3, vertex.size = 12, vertex.frame.color=“black”)

May you can help me


The dataset looks like this:

V(gnewc0)$color <- rainbow(17, alpha=.5)

list <- get.edgelist(gnewc0)
E(gnewc0)$color <-  apply(, 1, 
                 FUN = function(x) V(gnewc0)$color[x[1]])

plot(gnewc0, rescale=T, edge.color=E(gnewc0)$color, vertex.frame.color="black",
     vertexl.label.distance=200, vertex.label.font=1,
     edge.arrow.size=.3, vertex.size=12,