Error while using LightGraphs to load a graph (xml.gz) in Julia

262 Views Asked by At

I am trying to load a network in the format xml.gz in Julia by using GraphIO. The code is the following:

using LightGraphs
using GraphIO
D = loadgraphs("test.xml.gz", GraphMLFormat())

and I get the following error:

┌ 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

Then I have tried to import EzXML and do the following:

using LightGraphs
using GraphIO
using EzXML
r = GraphIO.GraphML.GraphMLFormat()
D = loadgraphs("test.xml.gz", r)

and I get the following error and I do not know how to fix it

┌ 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
  ...
1

There are 1 best solutions below

1
Simon Schoelly On BEST ANSWER

There seems to be something wrong with decompression - I can't tell you why but I could also reproduce with other zipped graphs.

Consider unzipping the graph (with gzip on linux for example):

gzip -c -d test.xml.gz  > test.xml

Then you should be able to load it with

D = loadgraph("test.xml", GraphIO.GraphML.GraphMLFormat())