Description
Hi,
for the kind of stuff we do in my research group (inference on graphs, message-passing algorithms) it would be great to have a graph library where one can store edge properties efficiently. For example we need to save for each edge a message in the form of a Vector{Float64}
, then loop over messages incoming to a certain node.
The currently available options seem to be:
- MetaGraphs.jl: properties are stored using
Dict
s, which is not very efficient nor elegant - SimpleWeightedGraphs.jl: for each edge one can store a 'weight', which is constrained to be
<:Real
, while it would be useful to have it more generic. Moreover, weights are stored as elements of aSparseMatrixCSC
meaning that setting a weight to zero will cause the edge to disappear (!)
One solution would be to assign an index 1,2,...,Nedges
to each edge. This way one can keep edge properties (of any type) in a separate vector, indexed by the edge index.
This requires a new type of edge which stores an index in addition to the usual source and destination fields. Something on the lines of
struct SimpleEdgeIndexed{T<:Integer} <: AbstractSimpleEdge{T}
src::T
dst::T
idx::T
end
instead of the StaticEdge
you mutuate from SimpleGraphs
. Everything else should more or less stay the same.
Do you think this makes sense? If so i can try and write it properly and do a PR.