I have a dataset similar to this.
library(igraph)
df <- data.frame(Account= c('Luca', 'Alberto', 'Luisa', 'Marcello', 'Tania'),
friend = c('Alberto', 'Luisa', 'Tania', 'Alberto', 'Luisa'))
edges1 = data.frame("from" =df$Account , "to" =df$friend , stringsAsFactors = F )
net <- graph_from_data_frame(d= edges1, directed = T)
V(net)$degree <- degree(net)
plot(net, vertex.size=20,
vertex.color=rainbow(11),
edge.arrow.width=0.7,
edge.lty= 6)
this is the result
I would like to color each edge the same color as the node it started from. For example, each link from Luca in red, each link from Luisa in yellow.
Couldn't find anything about it, thanks in advance
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…