My program generates a graph based on a .txt file. For example, if it is written 1,5 and 2,3 in the file, the program creates graph connecting 1st and 5th, and 2nd and 3rd nodes. Here is the code:
library(igraph)
dat<-read.table("file.txt", header = F, sep = ",")
dat[,c(1,2)]
vertices<-as.vector(t(dat[,1:2]))
g<-graph(vertices,directed = F)
plot(g,layout=layout.circle)
My question is: How can I do edge coloring based on some condition? For example, if the program reads 3,5 in file for the first time, I want the edge to be red, then if it reads again 3,5 I want the second edge to be blue, and if there is a third pair of 3,5 I want it to be yellow. Is this possible? Thanks.