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

MetaGraph to DOT seems buggy #73

Open
tecosaur opened this issue Nov 13, 2023 · 3 comments
Open

MetaGraph to DOT seems buggy #73

tecosaur opened this issue Nov 13, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@tecosaur
Copy link

MWE

julia> using MetaGraphsNext # v0.6.0

julia> struct Foo end

julia> g2 = MetaGraph(DiGraph(), label_type=Int, vertex_data_type=Foo)
Meta graph based on a SimpleDiGraph{Int64} with vertex labels of type Int64, vertex metadata of type Foo, edge metadata of type Nothing, graph metadata given by nothing, and default weight 1.0

julia> savegraph("data.dot", g2, DOTFormat())
ERROR: MethodError: no method matching length(::Foo)

Closest candidates are:
  length(::LibGit2.GitStatus)
   @ LibGit2 ~/.julia/juliaup/julia-1.10.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.10/LibGit2/src/status.jl:21
  length(::Tables.DictRowTable)
   @ Tables ~/.julia/packages/Tables/NSGZI/src/dicts.jl:118
  length(::Base.MethodSpecializations)
   @ Base reflection.jl:1164
  ...

Stacktrace:
 [1] show_meta_list(io::IOStream, meta::Foo)
   @ MetaGraphsNext ~/.julia/packages/MetaGraphsNext/YvA1m/src/persistence.jl:31
 [2] savedot(io::IOStream, meta_graph::MetaGraph{…})
   @ MetaGraphsNext ~/.julia/packages/MetaGraphsNext/YvA1m/src/persistence.jl:76
 [3] #32
   @ ~/.julia/packages/MetaGraphsNext/YvA1m/src/persistence.jl:100 [inlined]
 [4] open(::MetaGraphsNext.var"#32#33"{MetaGraph{}}, ::String, ::Vararg{String}; kwargs::@Kwargs{})
   @ Base ./io.jl:396
 [5] open
   @ Base ./io.jl:393 [inlined]
 [6] savegraph(file::String, meta_graph::MetaGraph{…}, ::DOTFormat)
   @ MetaGraphsNext ~/.julia/packages/MetaGraphsNext/YvA1m/src/persistence.jl:99
 [7] top-level scope
   @ REPL[13]:1
Some type information was truncated. Use `show(err)` to see complete types.
@gdalle
Copy link
Member

gdalle commented Nov 14, 2023

It's not clear to me how custom Julia types should be serialized as part of the DOT format.

https://en.m.wikipedia.org/wiki/DOT_(graph_description_language)

Perhaps JLD and friends are better options for this use case?

@tecosaur
Copy link
Author

In this case, I'm just serialising to DOT to try it as an alternative for plotting. Perhaps a better behaviour than current would be either:

  • Ignoring the vertex data
  • Using a custom vertex data serialisor keyword argument

@gdalle gdalle added the bug Something isn't working label Mar 27, 2024
@gdalle
Copy link
Member

gdalle commented Mar 27, 2024

That sounds reasonable, if you want to open a PR because it serves your use case I'll be happy to try and review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants