无法加载图表。将图表加载到 igraph(来自任意来源)"returned NULL"
Cannot load graphs. Loading graph to igraph (from arbitrary source) "returned NULL"
我正在使用 igraph 和 networkx,我尝试通过
将我的 nx 图转换为 igraph 图
nx.write_graphml(nx_graph,filepath) # Export NX graph to file
ig_graph = ig.read(filepath,format="graphml") # Create new IG graph from file
这在一台机器上运行良好,但在另一台机器上出现错误
SystemError: built-in method Read_GraphML of type object at 0x000002488D3FEE58 returned NULL without setting an error
我 运行 Windows10 和 Python 3.5。
有趣的是,在工作机器上,python-igraph 版本被指定为
“0.7.1”,而在故障系统上它是“0.7.1+5.3b99dbf6”,尽管我很确定通过 Christoph Gohlke 的文件完成了相同的安装过程。
错误也发生在像这样的简单测试设置中:
import igraph as ig
g = ig.Graph.Famous("zachary")
g.save("zachary.graphml")
g=ig.load("zachary.graphml")
因此,我很确定这与 networkx 生成的文件无关,而是我的 igraph 配置有问题。
我真的不知道系统上的差异可能在哪里,所以如果您有任何想法,请告诉我。
谢谢! :)
编辑:我也运行测试套件
import igraph.test
igraph.test.run_tests()
它在两种设置上都运行良好 - 即使是错误的设置。
我认为您在 python-igraph
的文件处理例程中遇到了一个已知错误,该错误仅出现在 Python 3.x 上(但不出现在 Python 2.x). This is the issue in the bug tracker; this is the explanation and this is the patch that fixes it。不幸的是,由于补丁后没有新版本,您需要自行重新编译 igraph 才能摆脱它。
但是请注意,只有在尝试加载图形时出现错误(异常)时才会触发该错误。我的第一个猜测是第二个系统上的 igraph 是在没有 GraphML 支持的情况下构建的,因此加载程序在读取文件时抛出异常(说明此构建中没有 GraphML 支持),这反过来触发了错误。
我正在使用 igraph 和 networkx,我尝试通过
将我的 nx 图转换为 igraph 图nx.write_graphml(nx_graph,filepath) # Export NX graph to file
ig_graph = ig.read(filepath,format="graphml") # Create new IG graph from file
这在一台机器上运行良好,但在另一台机器上出现错误
SystemError: built-in method Read_GraphML of type object at 0x000002488D3FEE58 returned NULL without setting an error
我 运行 Windows10 和 Python 3.5。 有趣的是,在工作机器上,python-igraph 版本被指定为 “0.7.1”,而在故障系统上它是“0.7.1+5.3b99dbf6”,尽管我很确定通过 Christoph Gohlke 的文件完成了相同的安装过程。
错误也发生在像这样的简单测试设置中:
import igraph as ig
g = ig.Graph.Famous("zachary")
g.save("zachary.graphml")
g=ig.load("zachary.graphml")
因此,我很确定这与 networkx 生成的文件无关,而是我的 igraph 配置有问题。 我真的不知道系统上的差异可能在哪里,所以如果您有任何想法,请告诉我。
谢谢! :)
编辑:我也运行测试套件
import igraph.test
igraph.test.run_tests()
它在两种设置上都运行良好 - 即使是错误的设置。
我认为您在 python-igraph
的文件处理例程中遇到了一个已知错误,该错误仅出现在 Python 3.x 上(但不出现在 Python 2.x). This is the issue in the bug tracker; this is the explanation and this is the patch that fixes it。不幸的是,由于补丁后没有新版本,您需要自行重新编译 igraph 才能摆脱它。
但是请注意,只有在尝试加载图形时出现错误(异常)时才会触发该错误。我的第一个猜测是第二个系统上的 igraph 是在没有 GraphML 支持的情况下构建的,因此加载程序在读取文件时抛出异常(说明此构建中没有 GraphML 支持),这反过来触发了错误。