答案 0 :(得分:2)
您可以将边缘颜色传递到绘图功能...
library(igraph)
cust <- c("Jeff", "Jared", "Ronald", "Donald","Barry")
stores <- c("Walmart", "Bestbuy", "McDonalds", "Amazon", "Target","Lowes", "Subway","RadioShack", "Macys","TJ Max")
trans <- c("Disputed", "Undisputed")
df <- data.frame(cust=rep(cust, 5), store=sample(stores, 25, replace = T), trans=sample(trans, 25, replace = T, prob=c(0.3, 0.7)))
g <- graph_from_data_frame(df)
plot(g, edge.color=as.character(factor(df$trans,labels = c("Red", "Blue4"))), edge.arrow.size=0, edge.width=2)