导入大 iGraph 内存耗尽
我正在尝试导入一个大的 LGL 文件(~2GB),并且我正在尝试使用 igraph 导入它
graph = Graph.Read_Lgl("Biggraph.lgl")
。它抛出的错误是
Traceback (most recent call last):
File "graph.py", line8, in <module>
graph = Graph.Read_Lgl("Biggraph.lgl")
igraph.core.InternalError: Error at foreign.c:359: Parse error in LGL file, line 9997 (memory exhausted), Parse Error
我不确定这里到底发生了什么。内存耗尽错误让我认为分配给 python(或底层 C)的内存在尝试读取文件时已被用完,但它几乎立即发生,就像它甚至没有一样尝试做很多事情。也许它会查看文件大小并说“哇,不能这样做。”
但说真的,我不知道发生了什么。我对 iGraph 的假设是它可以处理非常大的图,而且我不认为我的图对它来说太大了。
我确实自己生成了 lgl 文件,但我相信我的语法是正确的。这个错误看起来并不像是我的 lgl 文件有问题,但我可能是错的(“解析错误”有点让我害怕)。
我只是想我应该在这里尝试一下,看看是否有更热衷于 iGraph 操作方式的人知道如何快速解决这个问题(或扩展内存)。谢谢。
I'm trying to import a large LGL file (~2GB) and I am attempting to import this in igraph using
graph = Graph.Read_Lgl("Biggraph.lgl")
The error it is throwing is
Traceback (most recent call last):
File "graph.py", line8, in <module>
graph = Graph.Read_Lgl("Biggraph.lgl")
igraph.core.InternalError: Error at foreign.c:359: Parse error in LGL file, line 9997 (memory exhausted), Parse Error
I'm unsure as to what exactly is going on here. The memory exhausted error is making me think that the memory allocated to python (or the underlying C) is being used up when trying to read the file, but it almost happens instantly, like it isn't even trying to do much. Maybe it's looking at the file size and saying 'woah, can't do that.'
Seriously though, I have no idea what is happening. What I assumed from iGraph is that it can handle extremely large graphs, and I dont think my graph is too large for it.
I did generate the lgl file myself, but I believe I have the syntax correct. This error doesn't really seem like there is a problem with my lgl file, but I could be wrong ("Parse error" kind of scares me).
I just figured I'd try here and see if anyone more keen on how iGraph operates would know how to quickly solve this problem (or extend the memory). Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据记录,发布者在 igraph 库中发现了一个错误,我们正在努力修复。该问题是由 LGL 格式的
bison
解析器规范中的右递归规则引起的。一旦我们在项目主干中拥有了它的官方补丁,如果其他人遇到同样的问题,我将在此处发布补丁的 URL。更新:
补丁的 URL 为:
For the record, the poster has found a bug in the igraph library and we are working on a fix right now. The problem is caused by a right-recursive rule in the
bison
parser specification for the LGL format. Once we have an official patch for it in the trunk of the project, I will post the URL of the patch here should others run into the same problem.Update:
The URLs to the patches are: