BioJulia / Bio.jl

[DEPRECATED] Bioinformatics and Computational Biology Infrastructure for Julia
http://biojulia.dev
MIT License
261 stars 65 forks source link

Just a heads up... #481

Closed sbromberger closed 6 years ago

sbromberger commented 7 years ago

This new package might be of use to you. It extends LightGraphs to allow arbitrary vertex, edge, and graph metadata. Not in METADATA.jl yet, but hopefully within the next 24h.

https://github.com/JuliaGraphs/MetaGraphs.jl

kescobo commented 7 years ago

Neat, thanks for the heads up!

I might have missed it, but is there a way to get nodes/edges based on a property? Eg. get the index for edges with :action == "knows"?

Maybe I should move this to an issue on your repo, but it seems too trivial for that.

sbromberger commented 7 years ago

There's an opportunity for some syntactic sugar / convenience function, but in the meantime, you can do

filter(x->has_prop(g,  x, :action), edges(g))

That will get you all the edges that have the :action property set – not the value, for which you'd probably need

filter(x->has_prop(g, x, :action) && get_prop(g,  x, :action) == "knows", edges(g))
sbromberger commented 7 years ago

@kescobo You've inspired me: https://github.com/JuliaGraphs/MetaGraphs.jl/pull/2