How do I store a data structure at the nodes of a graph from Graphs.jl?

Say I have a data structure with a “location” (ComplexF64) and a value (Float64) and I want to associate each node of a SimpleGraph from Graphs.jl to each node to keep track of connections between nodes. How should I go about this to ensure that methods from the library can act on it? That is to say, how do I implement the Graphs.SimpleGraphs.AbstractSimpleGraph interface?

struct Node
    loc::ComplexF64
    val::Float64
end
1 Like

You might have luck with MetaGraphs or MetaGraphsNext or MetaDataGraphs

3 Likes

MetaGraphs.jl seems perfect! Thank you so much! I did notice that the last commit on the project was on Nov 3, 2021. Should I be concerned that the project is going to be not maintained in the future and/or will encounter documented bugs that have not been addressed?

Edit: I noticed that MetaGraphsNext.jl is being actively developed. Apologies for the last message. Appreciate the help!

1 Like

Note that MetaDataGraphs now has a deprecation notice directing users to MetaGraphsNext.jl

1 Like