I have made a network graph in R for the transaction between 5 customers and 10 merchants, there are some "Disputed" and some "Undisputed"
transcations in it, how can I show these edges corresponding to these to different kind of transactions with different color
You can pass edge colors into the plot function...
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)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With