16
votes

I want to change the edge width of my graph to correspond to the edge.betweenness score.

 net <- read.csv("D:/SNA/R/Net.csv")
 att <- read.csv("D:/SNA/R/Att.csv")
 g <- graph.data.frame(net, vertices=att, directed=TRUE)
 pdf("Network.pdf", pointsize=8)
 plot(g, vertex.label=NA, vertex.size=3, edge.width=edge.betweenness(g))
 dev.off()

I have also tried creating the edge betweenness score as an edge weight and assigning it to edge.width argument in the plot function as follows;

plot(g, vertex.label=NA, vertex.size=3, edge.width=E(g)$width
1
Can you provide some sample data I can use to re-create your graphChristie Haskell Marsh
Your example should work. Maybe you don't see the difference, because the edge betweenness scores are close to each other. We actually don't even know what you see, what the problem is.....Gabor Csardi
Error that I get is; Error in i.parse.plot.params(graph, list(...)) : Unknown edge parameters: weightP Mcquiy
Thanks for the comments, I have been able to make it work..P Mcquiy
Why not put simple replica for Net.csv and Att.csv so that all R community can make use of this question better. See, e.g., set.seed(1); data.frame(replicate(4, rnorm(100)))Erdogan CEVHER

1 Answers

13
votes

Your example should work. Alternatively, you can write

E(g)$weight <- edge.betweenness(g)

before the plotting function.