Open rdurelli opened 2 years ago
Can you try using Graphs.jl instead of LightGraphs.jl ? Since not too long ago the main graph packet for julia is Graphs.jl. https://discourse.julialang.org/t/lightgraphs-jl-transition/69526
Maybe LightGraphs is not exporting loadgraph
but I wouldn't know for sure.
hi @filchristou,
i am using Julia 1.10.5 (2024-08-27). i have trouble loading GML files too. I am not sure if it is exactly the same problem. additionally, i am very new to Julia. maybe it is just a simple thing that I miss.
this is what i did, trying to follow as good as it gets the documentation on the README.md.
package installation.
using Pkg
Pkg.add("CodecZlib")
Pkg.add("GraphIO")
Pkg.add("Graphs")
load gml.
using CodecZlib
using GraphIO
graph = loadgraph("output/output00000024_neighbor.gml", "graph_key", GMLFormat())
this is the Error i get:
ERROR: UndefVarError: `GMLFormat` not defined
Stacktrace:
[1] top-level scope
@ REPL[9]:1
so, something with the installation or loading of the packages seems to go wrong.
i tried as well what is mentioned under issue #26 but it did not solve the problem.
import CodecZlib
using GraphIO
graph = loadgraph("output/output00000024_neighbor.gml", "graph_key", GMLFormat())
i tried to install the ParserCombinator package too, but there is even written that GraphIOGMLExt not compiles.
julia> Pkg.add("ParserCombinator")
Resolving package versions...
Updating `~/.julia/environments/v1.10/Project.toml`
[fae87a5f] + ParserCombinator v2.2.1
Updating `~/.julia/environments/v1.10/Manifest.toml`
[15f4f7f2] + AutoHashEquals v2.1.0
[fae87a5f] + ParserCombinator v2.2.1
[0dad84c5] + ArgTools v1.1.1
[f43a241f] + Downloads v1.6.0
[7b1f6079] + FileWatching
[b27032c2] + LibCURL v0.6.4
[76f85450] + LibGit2
[56ddb016] + Logging
[ca575930] + NetworkOptions v1.2.0
[44cfe95a] + Pkg v1.10.0
[a4e569a6] + Tar v1.10.0
[deac9b47] + LibCURL_jll v8.4.0+0
[e37daf67] + LibGit2_jll v1.6.4+0
[29816b5a] + LibSSH2_jll v1.11.0+1
[c8ffd9c3] + MbedTLS_jll v2.28.2+1
[14a3606d] + MozillaCACerts_jll v2023.1.10
[8e850ede] + nghttp2_jll v1.52.0+1
[3f19e933] + p7zip_jll v17.4.0+2
┌ Warning: Circular dependency detected. Precompilation will be skipped for:
│ GraphIOGMLExt [10735248-2040-59e9-9abe-fdd6b710d968]
│ GraphIODOTExt [ab8fad05-3411-592a-a0d6-35146cf9cd29]
└ @ Pkg.API ~/src_git/julia-1.10.5/share/julia/stdlib/v1.10/Pkg/src/API.jl:1279
could you please help me further? i attached the type of gml files i try to load. I had to add a .txt at the end, to be able to attach. output00000024_neighbor.gml.txt
thank you, Elmar
Hey. Nice post. You make it easy to help you.
as described in README you need to do using ParserCombinator
if you want to read GML. This is because of the package extensions.
Now GraphML.GML.GMLFormat
will be defined and you can do
julia> loadgraph("gmlfile.gml", GraphIO.GML.GMLFormat())
However I just saw your data.. it looks like you have metadata inside and this is not supported at the moment.
The only package I know that supports MetaGraphs.jl reading is my unregistered NestedGraphIO.jl but only works for graphml
types..
Since a while i wanted to get away from MetaGraphs.jl and use MetaGraphsNext.jl instead. If you want to tackle MetaGraphsNext.jl support for GML format you can try that out with a PR :) I will be happy to support you.
wow! this is a quick respond. thank you, @filchristou!
listen, i am a Python programmer, and this is about my first day walking in Julia. i was looking into Julia and GraphIO.jl to make my library available for Julia users (because of entry hooks one can run the major commands from my library straight from the command line).
that's being said: a beautiful language you have!
i am interested to help, and make a pr, but this will take a while!
school semester just started, and soon i will be overloaded. the only thing i try to do before that, is to get the pcdl release out.
some thoughts about the README :
according to the README using CodecZlib
should work too. testing now with both, the way you wrote, only add ParserCombinator
seems to work! So, maybe the README should be updated?
this is what I get using CodecZlib
:
ERROR: MethodError: no method matching loadgraph(::IOStream, ::String, ::GraphIO.GML.GMLFormat)
this is what I get using ParserCombinator
:
ERROR: ParserError{Int64}("Expected ] at (10,5)\n cell_type \"cancer_cell\"\n ^\n", 141)
parse error as you said! i assume otherwise it would work.
what was very helpful from your reply, and not obvious from the README, is that i specify the format with GraphIO.GML.GMLFormat()
. in the README it is only EdgeListFormat()
. should it not as well be GraphIO.EdgeList.EdgeListFormat()
?
keep in mind, you speak to a person who knows Julia for a night and a day : ).
we will use gml with metadata in the future! i will come back to this. but frankly, it will most probably become next summer. for now I have to leave it there. by the way, this is the original gml specification. was hard to find and might come in handy.
thank you once again for this prompt reply. best, Elmar
Hello guys, Im trying to load a gml file, but I got some issues:
using LightGraphs, ParserCombinator, GraphIO graph = loadgraph("output.gml", "digraph", GraphIO.GML.GMLFormat())
When I execute the source code I always get the following message: ERROR: LoadError: UndefVarError: loadgraph not defined