juliagraphs / metagraphs.jl Goto Github PK
View Code? Open in Web Editor NEWGraph data structures with multiple heterogeneous metadata for Graphs.jl.
Home Page: https://juliagraphs.org/MetaGraphs.jl/
License: Other
Graph data structures with multiple heterogeneous metadata for Graphs.jl.
Home Page: https://juliagraphs.org/MetaGraphs.jl/
License: Other
The GitHub Pages link to the documentation returns a 404 error.
See sbromberger/MetaGraphs.jl#119
Same issue in MetaGraphsNext: JuliaGraphs/MetaGraphsNext.jl#14
MetaGraphs was working with LightGraphs.jl before but this isn't the case anymore.
julia> using LightGraphs, MetaGraphs
julia> g = DiGraph(5)
julia> G = MetaDiGraph(g)
ERROR: MethodError: no method matching Graphs.SimpleGraphs.SimpleDiGraph(::SimpleDiGraph{Int64})
Closest candidates are:
Graphs.SimpleGraphs.SimpleDiGraph() ...
Similar to Julia's Base.get
would be nice to have get_prop(mgr::AbstractMetaGraph, v, defaultvalue)
, get_prop(mgr::AbstractMetaGraph, n1, n2, defaultvalue)
and so on.
The implementation should be super easy. Just checking with has_prop
and act appropriately.
Personally I would find that useful. Other opinions ?
Hi
I get a number of problems with MetaGraphs.
Any help is welcome.
Laurent
PS: I am a biologist not very well skilled at Julia and programing in general.
julia> using Graphs, MetaGraphs, DataFrames, GraphDataFrameBridge
julia> g=complete_graph(3)
{3, 3} undirected simple Int64 graph
julia> mg=MetaGraphs.MetaGraph(g)
ERROR: MethodError: no method matching LightGraphs.SimpleGraphs.SimpleGraph(::SimpleGraph{Int64})
Closest candidates are:
LightGraphs.SimpleGraphs.SimpleGraph(::Any, ::Array{Vector{T}, 1}) where T at C:\Users\Laurent\.julia\packages\LightGraphs\IgJif\src\SimpleGraphs\simplegraph.jl:18
LightGraphs.SimpleGraphs.SimpleGraph() at C:\Users\Laurent\.julia\packages\LightGraphs\IgJif\src\SimpleGraphs\simplegraph.jl:50
LightGraphs.SimpleGraphs.SimpleGraph(::MetaGraph) at C:\Users\Laurent\.julia\packages\MetaGraphs\UlMik\src\metagraph.jl:50
...
Stacktrace:
[1] MetaGraph(x::SimpleGraph{Int64}, weightfield::Symbol, defaultweight::Float64)
@ MetaGraphs ~\.julia\packages\MetaGraphs\UlMik\src\metagraph.jl:14
[2] MetaGraph(x::SimpleGraph{Int64})
@ MetaGraphs ~\.julia\packages\MetaGraphs\UlMik\src\metagraph.jl:26
[3] top-level scope
@ REPL[20]:1
julia> df = DataFrame(src=["g1", "g2", "g3"], dst=["g2", "g3", "g1"], weight=[1, 1 ,1])
3×3 DataFrame
Row │ src dst weight
│ String String Int64
─────┼────────────────────────
1 │ g1 g2 1
2 │ g2 g3 1
3 │ g3 g1 1
julia> mg=GraphDataFrameBridge.MetaGraph(df, :src, :dst, weight=:weight)
{3, 3} undirected Int64 metagraph with Float64 weights defined by :weight (default weight 1.0)
julia> vertices(mg)
ERROR: MethodError: no method matching vertices(::MetaGraph{Int64, Float64})
Closest candidates are:
vertices(::Graphs.SimpleGraphs.AbstractSimpleGraph) at C:\Users\Laurent\.julia\packages\Graphs\Mih78\src\SimpleGraphs\SimpleGraphs.jl:58
vertices(::AbstractGraph) at C:\Users\Laurent\.julia\packages\Graphs\Mih78\src\interface.jl:181
Stacktrace:
[1] top-level scope
@ REPL[23]:1
julia> vertices(g)
Base.OneTo(3)
julia> edges(mg)
ERROR: method edges not implemented.
Stacktrace:
[1] _NI(m::String)
@ Graphs ~\.julia\packages\Graphs\Mih78\src\interface.jl:16
[2] edges(g::MetaGraph{Int64, Float64})
@ Graphs ~\.julia\packages\Graphs\Mih78\src\interface.jl:207
[3] top-level scope
@ REPL[25]:1
julia> edges(g)
SimpleEdgeIter 3
I thought this should work, but it doesn't:
using Graphs
using MetaGraphs
g = path_graph(5)
mg = MetaGraph(g, 3.0)
set_prop!(mg, :description, "This is a metagraph.")
savegraph("/tmp/test_graph.lg", mg)
mg1 = loadgraph("/tmp/test_graph.lg")
ERROR: LoadError: BoundsError: attempt to access 2-element Vector{SubString{String}} at index [3]
Stacktrace:
[1] getindex
@ ./array.jl:861 [inlined]
[2] indexed_iterate
@ ./tuple.jl:90 [inlined]
[3] _parse_header(s::SubString{String})
@ Graphs ~/.julia/packages/Graphs/zrMoC/src/persistence/lg.jl:62
[4] loadlg(io::IOStream, gname::String)
@ Graphs ~/.julia/packages/Graphs/zrMoC/src/persistence/lg.jl:104
[5] loadgraph
@ ~/.julia/packages/Graphs/zrMoC/src/persistence/lg.jl:147 [inlined]
[6] #120
@ ~/.julia/packages/Graphs/zrMoC/src/persistence/common.jl:15 [inlined]
[7] open(::Graphs.var"#120#121"{String, LGFormat}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:330
[8] open
@ ./io.jl:328 [inlined]
[9] loadgraph
@ ~/.julia/packages/Graphs/zrMoC/src/persistence/common.jl:14 [inlined]
[10] loadgraph(fn::String)
@ Graphs ~/.julia/packages/Graphs/zrMoC/src/persistence/common.jl:18
[11] top-level scope
@ untitled-55510ba3fa4677b8db7457446bdad39a:10
Is it something to do with the compressed format - savegraph(.. ... metagraph ... , compress=false)
doesn't work either?
Using Graphs v1.7.0, MetaGraphs v0.7.1, Julia 1.7.
The link to MetaGraph's documentation appears to be broken.
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.
Hi all, been enjoying using MetaGraphs in my research. What's the best way to cite this work in a publication (academic paper)?
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
It would be nice to support indexing on edges, as is done on nodes. This would allow querying an edge based on the index:
For example, g["edge_name", :id]
would return the Edge
that has that id.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.