I am trying to generate an Igraph in R. Now I want the edge color dependent on an edge attribute - department. I cannot use ifelse statement because department values can be dynamic. I can find the number of unique departments, but I am not sure how to proceed further in creating different edge colors for different departments.
department= unique(edges$department)
department.count=length(department)
Example Code:
gg <- graph.atlas(711)
V(gg)$name=1:7
gg=set_edge_attr(gg,"Department",E(gg)1:10],c("A","B","C","A","E","C","G","B","C","A"))
E(gg)$label=E(gg)$Department
plot(gg)
I want to have different colors for each edge, depending on values of department in edge. All 'A' departments in one color , all B department edges in another color , so on. Kindly help.