I would like to plot a supply network structure. I have tried to use igraph, but until now did not come up with a reasonable result. An example would look like this:
library(igraph)
d <- read.table(text = "V1 V2 weight
s1 p1 88
s3 p1 100
s2 p2 100
s3 p2 43
p1 c1 21
p1 c2 79
p1 c3 88
p2 c1 22
p2 c2 121
", stringsAsFactors = F, header = T)
g <- graph_from_data_frame(d, directed = T)
plot(g, layout=layout.fruchterman.reingold,
edge.width=E(g)$weight/20,
vertex.shape = "none", vertex.label.font = 2,
vertex.label.cex=1.1, edge.color="gray70")
Which gives:
The problem is that the network has an additional structure. A resonable - among others - result would show the "s"-nodes (for suppliers) should be in the left third, the "p"-nodes (plants) should be in the middle and the c-nodes (customers) on the right hand side. Is this even doable with igraph (and how)? Is there another package that could do this?