在jython中使用Gephi的GraphDistance插件:我有正确的类型,但是'execute'方法不同意

2024-05-15 09:59:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试在gephi/jython中运行一个图度量算法。不幸的是,我不能在GraphDistance对象中调用方法“execute”。在

这是我需要使用的统计对象的类:

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

图形类的类型如下:

^{2}$

它实际上是HierarchicalGraph的一个子类:

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

我还按要求提供了“attributes”对象:

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

但execute声明所需类型不正确:

>>> 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

这对我来说没有多大意义,因为我使用的graph对象的类是从所需的类派生出来的。在

有什么想法吗?在

编辑:我正在使用Gephi脚本插件(http://wiki.gephi.org/index.php/Scripting_Plugin)和gephi0.8.2-beta。给你系统版本公司名称:

>>> 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)]'

Tags: 对象orgapi类型executetypeattributesgraph
1条回答
网友
1楼 · 发布于 2024-05-15 09:59:14

class中有两个execute方法

public void execute(GraphModel graphModel, AttributeModel attributeModel);

public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel);

听起来第二个参数应该是AttributeModel,而不是AttributeRowImpl。在

相关问题 更多 >