意外的错误读取GML图 [英] Unexpected error reading GML graph

查看:128
本文介绍了意外的错误读取GML图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了包含海豚社交网络的gml文件.

I have downloaded the gml file which contains the dolphins social network.

前段时间,我在Windows7机器上运行python 3.4和 networkx 1.9 的网络上进行了一些分析,但现在我在Arch Linux机器上运行(具有相同版本的python,但使用networkx 1.10 ),并在尝试读取文件时发现了一个问题.

Some time ago I did some analysis on that network running python 3.4 and networkx 1.9 on a a Windows7 machine, but now I am running on a Arch linux machine (with the same version of python but with networkx 1.10) and found an issue when tried to read the file.

这是用于读取文件的代码:

This is the code used to read the file:

import networkx as nx
nx.read_gml("dolphins.gml")

这是错误的堆栈跟踪:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 2, in read_gml
File "/usr/lib/python3.4/site-packages/networkx/utils/decorators.py",line 220, in _open_file
result = func(*new_args, **kwargs)
File "/usr/lib/python3.4/site-packages/networkx/readwrite/gml.py", line 210, in read_gml
G = parse_gml_lines(filter_lines(path), label, destringizer)
File "/usr/lib/python3.4/site-packages/networkx/readwrite/gml.py", line 383, in parse_gml_lines
graph = parse_graph()
File "/usr/lib/python3.4/site-packages/networkx/readwrite/gml.py", line 372, in parse_graph
curr_token, dct = parse_kv(next(tokens))
File "/usr/lib/python3.4/site-packages/networkx/readwrite/gml.py", line 323, in tokenize
(line[pos:], lineno + 1, pos + 1))
networkx.exception.NetworkXError: cannot tokenize 'graph' at (1, 1)

您可以读取文件吗?有人遇到过类似的问题吗?还是知道是什么导致了错误?

Are you able to read the file? Someone has experienced a simmilar issue? or knows what is generating the error?

提前谢谢!

推荐答案

它通过将networkx版本从1.10降级到1.9.1来工作.

It worked by downgrading the networkx version from 1.10 to 1.9.1.

希望这个答案可以帮助其他人.

Hope this answer can help someone else.

这篇关于意外的错误读取GML图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆