18

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
P Mcquiy
  • 305
  • 1
  • 4
  • 10

1 Answers1

15

Your example should work. Alternatively, you can write

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

before the plotting function.

Piotr Migdal
  • 11,864
  • 9
  • 64
  • 86