在 Julia 中使用 LightGraphs 加载图形 (xml.gz) 时出错
Error while using LightGraphs to load a graph (xml.gz) in Julia
我正在尝试使用 GraphIO 在 Julia 中以 xml.gz 格式加载网络。
代码如下:
using LightGraphs
using GraphIO
D = loadgraphs("test.xml.gz", GraphMLFormat())
我收到以下错误:
┌ Warning: `GraphIO.GraphMLFormat` has been moved to submodule `GraphIO.GraphML` and needs `EzXML.jl` to be imported first. I.e. use
│ using EzXML
│ GraphIO.GraphML.GraphMLFormat()
│ caller = top-level scope at test.jl:3
└ @ Core ~/File/Code/test_graph/test.jl:3
ERROR: LoadError: UndefVarError: GraphML not defined
然后我尝试导入 EzXML 并执行以下操作:
using LightGraphs
using GraphIO
using EzXML
r = GraphIO.GraphML.GraphMLFormat()
D = loadgraphs("test.xml.gz", r)
我收到以下错误,但我不知道如何解决
┌ Warning: `GraphIO.GraphMLFormat` has been moved to submodule `GraphIO.GraphML` and needs `EzXML.jl` to be imported first. I.e. use
│ using EzXML
│ GraphIO.GraphML.GraphMLFormat()
│ caller = top-level scope at test.jl:5
└ @ Core ~/File/Code/test_graph/test.jl:5
ERROR: LoadError: MethodError: no method matching bytesavailable(::Inflate.InflateGzipStream)
Closest candidates are:
bytesavailable(!Matched::Base.SecretBuffer) at secretbuffer.jl:153
bytesavailable(!Matched::Base.Filesystem.File) at filesystem.jl:198
bytesavailable(!Matched::Base.BufferStream) at stream.jl:1243
...
解压缩似乎有问题 - 我不能告诉你原因,但我也可以用其他压缩图重现。
考虑解压缩图表(例如,在 linux 上使用 gzip):
gzip -c -d test.xml.gz > test.xml
那么你应该可以用
加载它
D = loadgraph("test.xml", GraphIO.GraphML.GraphMLFormat())
我正在尝试使用 GraphIO 在 Julia 中以 xml.gz 格式加载网络。 代码如下:
using LightGraphs
using GraphIO
D = loadgraphs("test.xml.gz", GraphMLFormat())
我收到以下错误:
┌ Warning: `GraphIO.GraphMLFormat` has been moved to submodule `GraphIO.GraphML` and needs `EzXML.jl` to be imported first. I.e. use
│ using EzXML
│ GraphIO.GraphML.GraphMLFormat()
│ caller = top-level scope at test.jl:3
└ @ Core ~/File/Code/test_graph/test.jl:3
ERROR: LoadError: UndefVarError: GraphML not defined
然后我尝试导入 EzXML 并执行以下操作:
using LightGraphs
using GraphIO
using EzXML
r = GraphIO.GraphML.GraphMLFormat()
D = loadgraphs("test.xml.gz", r)
我收到以下错误,但我不知道如何解决
┌ Warning: `GraphIO.GraphMLFormat` has been moved to submodule `GraphIO.GraphML` and needs `EzXML.jl` to be imported first. I.e. use
│ using EzXML
│ GraphIO.GraphML.GraphMLFormat()
│ caller = top-level scope at test.jl:5
└ @ Core ~/File/Code/test_graph/test.jl:5
ERROR: LoadError: MethodError: no method matching bytesavailable(::Inflate.InflateGzipStream)
Closest candidates are:
bytesavailable(!Matched::Base.SecretBuffer) at secretbuffer.jl:153
bytesavailable(!Matched::Base.Filesystem.File) at filesystem.jl:198
bytesavailable(!Matched::Base.BufferStream) at stream.jl:1243
...
解压缩似乎有问题 - 我不能告诉你原因,但我也可以用其他压缩图重现。
考虑解压缩图表(例如,在 linux 上使用 gzip):
gzip -c -d test.xml.gz > test.xml
那么你应该可以用
加载它D = loadgraph("test.xml", GraphIO.GraphML.GraphMLFormat())