JuliaGraphs / MetaGraphs.jl

Graph data structures with multiple heterogeneous metadata for Graphs.jl.
https://juliagraphs.org/MetaGraphs.jl/
Other
58 stars 8 forks source link

MetaGraph does not accept SimpleGraph properly #31

Closed racinmat closed 2 years ago

racinmat commented 2 years ago
using LightGraphs, MetaGraphs
g = LightGraphs.SimpleGraphs.grid([5, 24])
MetaGraph(g)

crashes with

ERROR: LoadError: MethodError: no method matching Graphs.SimpleGraphs.SimpleGraph(::SimpleGraph{Int64})
Closest candidates are:
  Graphs.SimpleGraphs.SimpleGraph(::Any, ::Array{Vector{T}, 1}) where T at C:\Users\racinsky\.julia\packages\Graphs\Mih78\src\SimpleGraphs\simplegraph.jl:18
  Graphs.SimpleGraphs.SimpleGraph() at C:\Users\racinsky\.julia\packages\Graphs\Mih78\src\SimpleGraphs\simplegraph.jl:50
  Graphs.SimpleGraphs.SimpleGraph(::Graphs.SimpleGraphs.SimpleGraph) at C:\Users\racinsky\.julia\packages\Graphs\Mih78\src\SimpleGraphs\simplegraph.jl:115
  ...
Stacktrace:
 [1] MetaGraph(x::SimpleGraph{Int64}, weightfield::Symbol, defaultweight::Float64)
   @ MetaGraphs C:\Users\racinsky\.julia\packages\MetaGraphs\bffKb\src\metagraph.jl:14
 [2] MetaGraph(x::SimpleGraph{Int64})
   @ MetaGraphs C:\Users\racinsky\.julia\packages\MetaGraphs\bffKb\src\metagraph.jl:26
 [3] top-level scope
   @ c:\Projects\others\advent_of_code_2021\loading_data.jl:545
in expression starting at c:\Projects\others\advent_of_code_2021\loading_data.jl:545

that's because without parameters it does not dispatch to https://github.com/JuliaGraphs/MetaGraphs.jl/blob/master/src/metagraph.jl#L36.

racinmat commented 2 years ago

Sorry, I missed the fact that it migrated to Graphs from LightGraphs.