1

我需要在一个项目中将 python 与 Java 结合使用,其中图形(具有节点和边的那种)起着重要作用。我想在一个简单的 GUI 中可视化这些图表,并每隔一秒左右更新它的节点标签/边权重/任何东西。我还想从 graphml 格式的文件中加载图表。

许多人建议使用 Networkx,但似乎不适用于 Jython,对吗?如果没有,我会得到一个

SyntaxError: 'import *' not allowed with 'from .'

Networkx egg 内部的错误。即使它有效,我也需要 Numpy 和 matplotlib 才能工作,我不确定它们是否能与 Jython 一起工作。

所以首先,你能帮我解决这些 NetworkX 问题吗?其次,您可以为我的目的推荐 Networkx 的替代品吗?

4

1 回答 1

0

Jython is python language spec inside of the JVM much like JRuby.

NetworkX source code is C or fortran (don't remember which). Numpy/Scipy are C based (great packages for scientific computing). Matplotlib is c (for display of the graphs).

NetworkX will help create graphs, matplotlib will help display them but both may not work in Jython.

If you need c based resources try jpype; its older (python 2.7) but will allow some functionality between c and java using JNI (java native interface).

What I have done is create graphs in python then switch over to Gephi to visualize and display the graphs. Gephi is java based and a up and coming free tool.

于 2013-04-29T01:09:52.563 回答