0

I managed to perform this operation in order to make a visual representation of node degree using the following code:

 Datamatrix <- as.matrix(data[c("first","second")]) 
    CVET <- graph_from_edgelist(Datamatrix, directed=TRUE)    
    
    DCVET=degree(CVET)
     
    plot(CVET,
         vertex.color=rainbow(52),
         vertex.size=DCVET*0.5,
         vertex.label.cex=0.6,
         edge.arrow.size=0.1, 
         layout=layout.kamada.kawai)

This produced the following plot:

Degree as attribute

When I tried to do the same using an other property of the nodes (betweenness) I obtained a graph that was unreadable. This is likely due to the fact that some values were huge when compared to others. The code and plot I obtained are here:Betweenness

data<-read.csv(file.choose(), header=T)

data

Datamatrix <- as.matrix(data[c("first","second")]) 

CVET <- graph_from_edgelist(Datamatrix, directed=TRUE)


 BCVET= betweenness(CVET, directed=TRUE)

    plot(CVET, 
         vertex.color=rainbow(52),
         vertex.size=BCVET*6,
         main='Betweenness',
         vertex.label.cex=0.6,
         edge.arrow.size=0.1, 
         layout=layout_nicely)

I'm looking for a way to display the second graph eliminating the smaller value so that the most important nodes in term of betweenness become apparent. I have tried various different layout options but didn't manage to do it. Could someone help?

phiver
  • 23,048
  • 14
  • 44
  • 56
Tavirio
  • 17
  • 5
  • 1
    It's not the layout that you need to change, but the vertex sizes. Have you tried downscaling all of them proportionally (instead of upscaling by a factor of 6, as in your example)? If yes, what was the problem? – Szabolcs Oct 29 '21 at 13:08
  • Thank you! That did help a lot indeed, even though it's still not quite it (there's still some overlap and it's hard to tell individual labels) that did improve the plot a LOT – Tavirio Oct 29 '21 at 14:59
  • Actually, combining a change in layout (layout.circle) with downscaling of vertex and labels is the perfect answer, I'm leaving the code in case someone comes by this post with this same question, thank you @Szabolcs once again! `plot(CVET, vertex.color=rainbow(52), vertex.size=BCVET*0.06, main='Betweenness', vertex.label.cex=0.4, edge.arrow.size=0.1, layout=layout.circle)` – Tavirio Oct 29 '21 at 15:05

0 Answers0