Giter Club home page Giter Club logo

metagraphs.jl's People

Contributors

affie avatar binary-eater avatar bovine3dom avatar danberge avatar dehann avatar dilumaluthge avatar femtocleaner[bot] avatar filchristou avatar gabriel-fallen avatar gdalle avatar henrik-wolf avatar jarbus avatar jpfairbanks avatar karajan9 avatar kescobo avatar leclere avatar matbesancon avatar pierretotale avatar r-barnes avatar sbromberger avatar serenity4 avatar simonschoelly avatar skleinbo avatar viralbshah avatar yuehhua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

metagraphs.jl's Issues

LightGraphs is not compatible anymore

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() ...

default values for `get_prop`

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 ?

Error messages with `MetaGraph`, `vertices`, and `edges`

Hi
I get a number of problems with MetaGraphs.

  1. The MetaGraph function of MetaGraphs does not convert a SimpleGraph to a MetaGraph. The error message refers to LightGraphs, which I uninstalled (rm LightGraphs) before adding Graphs.
  2. The vertices function works on a SimpleGraph and does not on a MetaGraph -> no method matching...
  3. The edges function works on a SimpleGraph and does not on a MetaGraph -> edges function not implemented

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

save/load not working?

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.

MetaGraph does not accept SimpleGraph properly

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.

How to cite

Hi all, been enjoying using MetaGraphs in my research. What's the best way to cite this work in a publication (academic paper)?

TagBot trigger issue

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!

Feature Request: indexing edges

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.