Radius of nodes in igraph degree()


I am using the igraph package in academia and it’s great ! I have two questions regarding the radius or scaling of nodes when using degree(graph, v, mode):

Is the radius of a node simply the square root of the number of its adjacent edges, or is there more damping involved in node growth ?

Where is the radius variable implemented in the source code … can I see it ?

Thank you for helping !


I’m not sure I understand the question. Can you give a specific, complete example?

The vertex.size option to plot specifies the radius of each vertex, not its area. This has nothing to do with where you are getting the sizes from (degrees or elsewhere).

The source of plot.igraph is here:

Thank you !

I am specifically interested in the radius, so you are getting me on the right track. I have checked the source, now, and have found in line 282 a variable that looks like the radius of a node: r <- sqrt((cp[,1]-center[1])**2 + (cp[,2]-center[2])**2). What I don’t get, right now, is what the (cp[,1]-center[1])**2 is all about (I am new to R). Any hints ?

You are asking about the source code, but I still don’t understand what the specific problem is. What problem are you trying to solve? Please be specific:

  • “I need to accomplish this task”
  • “This is the code I tried”
  • “This is what it did instead of what I needed”

Oh, right. I am driven by curiosity. I have to present a plot I generated with the degree function, pretty soon, and I expect questions on how the radius of nodes is computed in quantitative terms.

The degree function does not plot—it just returns the degrees of vertices. If you want to create a plot in which the radius of each vertex is proportional to its degree, you can use something like

plot(g, vertex.size=5*degree(g), vertex.label=NA)

Personally, I don’t often use the R interface of igraph, so I may be missing easier ways to do this. I usually work on the C core of igraph and on IGraph/M.

ah, ok. Your example implies that vertex.size is not the area, but is actually the radius of a node. But, Oops, you told me that already :slight_smile: My wrong. This was very helpful, indeed !