I want to plot a directed weighted network in which I could show stock transactions between participants. I'm not sure if we can add a 3rd columne ("TYPE") in a edgelist in the igraph R package. If so, can we differentiate the edges based on the purchased stock? e.g. Apple : blue edge, google : red edge, Pfizer: orange edge.
Edgelist
FROM TO VALUE TYPE
A B 100 Apple
B C 50 Pfizer
C D 80 Apple
A E 70 Google
require(igraph)
test<-as.matrix(edge_list_test)
test[,1]<-as.character(test[,1])
test[,2]<-as.character(test[,2])
test[,4]<-as.character(test[,4])
g<-graph.edgelist(test[,1:2], directed=TRUE)
V(g)$size=degree(g)
E(g)$type=as.character(test[,4])
E(g)$weight=as.numeric(test[,3])
plot(g, layout=layout.fruchterman.reingold, edge.width=E(g)$weight, vertex.color=V(g)$type, vertex.label.dist=0.5)][1]][1]
Why are the edges gray and can't see different colors on the edges based on the "TYPE"?