3

I am using R with igraph and I have a square matrix with weights. I want to sort it. I thought to use page.rank(g) and I got a corresponding vector and its values.

library(igraph)
g<-get.matrix()
page.rank(g)$value
page.rank(g)$vector

Now I want to sort using this values and visualizing it in a graph if it is possible. Something similar to the following picture:

enter image description here

How I could do this?

Gabor Csardi
  • 10,705
  • 1
  • 36
  • 53
Sergio
  • 780
  • 1
  • 9
  • 28
  • A [reproducible example](http://stackoverflow.com/q/5963269/420055) might be helpful. – chl Sep 04 '12 at 20:04

1 Answers1

3

Choose a force-based layout and set the vertex size (vertex.size) to be proportional to the page rank values. See an example on the igraph homepage on how to set the vertex size. (The example uses tkplot, but you can just use plot instead of that.) You can set the vertex labels via the vertex.label argument to plot, and \n is allowed to make multi-line labels.

Gabor Csardi
  • 10,705
  • 1
  • 36
  • 53