gpt4 book ai didi

java - 在jython中使用Gephi的GraphDistance插件: I have the correct types but the 'execute' method disagrees

转载 作者:行者123 更新时间:2023-12-02 07:21:33 31 4
gpt4 key购买 nike

我正在尝试在 gephi/jython 中运行图形度量算法。不幸的是,我无法在 GraphDistance 对象中调用“执行”方法。

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

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

图形类的类型是这样的:

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

这实际上是 HierarchicalGraph 的子类:

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

我还有所要求的“属性”对象:

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

但是执行表明所需的类型不正确:

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

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

有什么想法吗?

编辑:我正在使用 Gephi 脚本插件 ( http://wiki.gephi.org/index.php/Scripting_Plugin ) 和 Gephi 0.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)]'

最佳答案

class中有两个执行方法

public void execute(GraphModel graphModel, AttributeModel attributeModel);

public void execute(HierarchicalGraph hgraph, AttributeModel attributeModel);

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

关于java - 在jython中使用Gephi的GraphDistance插件: I have the correct types but the 'execute' method disagrees,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14156958/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com