Search code examples
javapythongraphjythongephi

Using Gephi's GraphDistance plugin in jython: I have the correct types but the 'execute' method disagrees


I am trying to run a graph metric algorithm in gephi/jython. Unfortunately I cannot call the method 'execute' in a GraphDistance object.

This is the class of statistics object I need to use:

>>> type(gd)
<type 'org.gephi.statistics.plugin.GraphDistance'>

The type of the graph class is this:

>>> type(gu)
<type 'org.gephi.graph.dhns.graph.HierarchicalUndirectedGraphImpl'>

That is actually a subclass of HierarchicalGraph:

>>> gu.class.__bases__[0].__bases__[0]
<type 'org.gephi.graph.api.HierarchicalGraph'>

I also have the 'attributes' object as requested:

>>> type(ga)
<type 'org.gephi.data.attributes.AttributeRowImpl'>

But the execute states that the required type is not correct:

>>> gd.execute(gu,ga)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: execute(): 1st arg can't be coerced to org.gephi.graph.api.HierarchicalGraph, org.gephi.graph.api.GraphModel

This does not make much sense for me since the class of the graph object I am using is derived from the class that is required.

Any ideas?

EDIT: I am using the Gephi Scripting plugin ( http://wiki.gephi.org/index.php/Scripting_Plugin ) and Gephi 0.8.2-beta. Here is sys.version:

>>> sys.version
'2.5.2 (Release_2_5_2:Unversioned directory, Jan 5 2012, 12:11:16) \n[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]'

Solution

  • There is two execute methods in that class

    public void execute(GraphModel graphModel, AttributeModel attributeModel);
    
    public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel);
    

    It sounds the 2nd argument should be AttributeModel, not AttributeRowImpl.