Search code examples
pythonjythongephi

Gephi scripting console not showing nodes


Am I missing something or is this a strange bug in Gephi scripting console ?

the console shows edges but no nodes

for example

>>> len(g.edges)
4314
>>> len(g.nodes)
1

>>> g.edges
set([e8926, e8794, e7024 ......])
>>> g.nodes
set([None])

You can replicate the error using the dataset Power Grid.gml provided with Gephi. I tested this on several datasets from here for example and got the same error.

Am I doing something wrong ?


Solution

  • there is a plugin named "Data Table", when you install it, you can see the structure of your dataset. i had a problem exactly like that, and i understood the node id, is a string not a number. if you want to see the difference in scripting Plugins execute g.nodes() command in Console Scripting Plugin, you can see (from "Data Table" Plugin that) the id of new created node is a number not a string. and when you execute g.nodes or len(g.nodes) in Gephi Console, you can see the new created node. I solve it in this way: i installed a Plugin named "Data Table", in can "Export Table", choose it, it tells you which columns you need to export you choose whatever you want but not the Id, then choose a separator and press Ok it will save it. make a new project, open "Data Table" plugins then click "Import SpreadSheet" from here you can insert your dataset with a new column named "Id" that gephi on its own add it to your DataSet