2

In Gephi, I have a quick question relating to node size and the python scripting console:

I have a list of many universities as nodes, with the amount of funding they get as an attribute column in the nodes tab. I'd like to have their nodes appear as the same proportional size as the amount of funding that they receive.

Is this possible using the scripting console/g.filter? If not how can i go about doing this normally?

  • I don't know anything about Gephi, but does [this question](https://stackoverflow.com/q/36239873/8186898) helps? – Nino Filiu Jul 03 '19 at 21:46
  • hi thanks for the response, I looked at that post but unfortunately it doesn't give me any information about using the scripting console to filter based on size. – Shaheel Mitra Jul 03 '19 at 21:54

1 Answers1

0

If you haven't found a solution yet, this code could help:

filter.py:

from java.awt import Color

for v in g.nodes:
    if v.indegree > 3:
        # can also do it like *g1 = g.filter(indegree > 3)* but needs some other       
        # tricks to change node attributes, as it does next
        #
        # changing some attributes to better display affected nodes
        v.size = 10
        v.size = 30 + 10 * v.indegree # modify size proportionally to in-degree
        v.color = Color(10, 30, 200, v.indegree * max(g.nodes.indegree))

Then in the Console plugin, go in and run something like:

execfile('<absolute path to filter.py>')

I put indegree in the script but, depending on your attribute, something like v.funding, could work. Typing, g.getNodeAttributes() in your Console, will let you know the actual node attribute names.

Yannis P.
  • 2,745
  • 1
  • 24
  • 39