Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UndefVarError: DOT not defined #34

Closed
pauljurczak opened this issue Sep 17, 2020 · 7 comments
Closed

UndefVarError: DOT not defined #34

pauljurczak opened this issue Sep 17, 2020 · 7 comments

Comments

@pauljurczak
Copy link

I'm trying to test basic functionality and I got stuck here:

julia> using LightGraphs, GraphIO

julia> graph = loadgraph("gr.dot", "gr", DOTFormat())
ERROR: UndefVarError: DOT not defined
Stacktrace:
 [1] DOTFormat() at /home/paul/.julia/packages/GraphIO/IgxnP/src/deprecations.jl:29
 [2] top-level scope at REPL[3]:1
 [3] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1088

I'm using Julia 1.5.1 on Ubuntu 18.04.

@simonschoelly
Copy link
Contributor

Some graph formats need additional packages - we did not want to make them mandatory for that package to reduce unnecessary dependencies, so you have to import them manually. I thought we had documented this in the README but apparently that is not the case.

In your case you need to install ParserCombinator and then write using ParserCombinator, then the dot format should be available.

@pauljurczak
Copy link
Author

Thank you, it works now. One more question, if I may: I thought that graph name is optional, but skipping it doesn't work:

julia> graph = loadgraph("gr.dot", DOTFormat())
ERROR: Graph graph not found
......
julia> graph = loadgraph("gr.dot", format=DOTFormat())
ERROR: MethodError: no method matching loadgraph(::String; format=GraphIO.DOT.DOTFormat())

Am I reading https://juliagraphs.org/LightGraphs.jl/stable/persistence/#LightGraphs.loadgraphs-Tuple{AbstractString,LightGraphs.AbstractGraphFormat} wrong?

@simonschoelly
Copy link
Contributor

The methods for importing dot are defined here:

loadgraph(io::IO, gname::String, ::DOTFormat) = loaddot(io, gname)
, looks like the signature there is slightly different.

@pauljurczak
Copy link
Author

pauljurczak commented Sep 17, 2020

So the documentation is not accurate, right?

EDIT

BTW, there is also:

loadgraphs(io::IO, ::DOTFormat) = loaddot_mult(io)

Doesn't it match loadgraph("gr.dot", DOTFormat()) ?

@pauljurczak
Copy link
Author

Never mind. This error:

julia> graph = loadgraph("gr.dot", DOTFormat())
ERROR: Graph graph not found

was caused by graph name different from "graph".

@yonkeltron
Copy link

Is there any way to make this clear from the error message?

@sbulcsu
Copy link

sbulcsu commented Sep 28, 2022

Same here:
ERROR: Graph graph not found
I had to check what is the name of the graph in the .graphml file and use that one:
<graph id="G" edgedefault="directed">
as
g = loadgraph("test.graphml", "G", GraphMLFormat())

This should be added to the Documentation/README.md and/or to the error message!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants