-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meta-issue: Use MetaGraphsNext.jl
for graphs with node and edge IDs
#732
Comments
MetaGraphsNext.jl
to represent the Ribasim graph with subnetworksMetaGraphsNext.jl
to represent the Ribasim graph with subnetworks
MetaGraphsNext.jl
to represent the Ribasim graph with subnetworksMetaGraphsNext.jl
for graphs with node IDs
MetaGraphsNext.jl
for graphs with node IDsMetaGraphsNext.jl
for graphs with node and edge IDs
Generalized the issue a bit so it is not only about the allocation graph, but all graphs. And if we can store any metadata on our graphs, we can put node IDs on vertices, edge IDs on edges. Perhaps other metadata like name and node type can also help with simplifying the code, avoiding extra mappings. https://juliagraphs.org/MetaGraphsNext.jl/stable/tutorial/1_basics/ |
It looks very promising, I think this can really clean up the allocation code and maybe more. What do you think about creating new objects for vertex and edge metadata? Example: struct VertexMetadata
type::Symbol # Could replace Parameters.lookup
data_index::Int # The index of this node in the node data
state_index::Int # If the node is a basin or PID controller, this is the index of the associated state variable
subnetwork_id::Int
end
struct EdgeMetadata
flow::Bool # Is it a flow edge?
control::Bool # Is it a control edge?
allocation::Bool # Is it an edge that is part of an allocation graph?
end It would make sense to me that the vertex labels are the non-consecutive node IDs (although that is discouraged in the link you sent). We also have to think about the construction of the metagraph; I think the metadata must be in some mutable object so that it can be altered after construction. I suppose metadata will not be altered during simulation. Regarding allocation:
|
Yes adding structs for this makes sense to me. I know it's only an example, but to comment on it already:
Indeed, this is the mentioned text:
That doesn't mean we shouldn't, but confusing struct ID # or rather, NodeID and EdgeID
id::Int
end That means we can dispatch on it, and we don't want to do any arithmetic on ID anyway. |
Sub-issues for using
|
MetaGraphsNext.jl
for graphs with node and edge IDsMetaGraphsNext.jl
for graphs with node and edge IDs
See here for a motivating discussion.
The text was updated successfully, but these errors were encountered: