-
Notifications
You must be signed in to change notification settings - Fork 19
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
Create function to plot #191
Comments
I started playing with this, but if someone else wants to tackle it while I'm gone, go ahead. |
Indeed, there is no way to nicely sum these because they are different structures but also because they are not indexed on the same sets.
So you have to iterate on the flows and aggregate these based on what you want. If you want all total = copy(parameters.flows_unit_capacity)
for f in sets.flows
if parameters.flows_investable[f]
total[f] += solution.flows_investment[f]
end
end And |
Yes that's exactly what I need, thanks! |
Is there a way to ask the graph where it's connections are FROM and TO? Because now I have this data in a |
Google seems to suggest we use a MetaGraph or MetaGraphsNext which would allow node names and weights? |
From the graph structure, something like this will give you the id and the name: for e ∈ edges(graph)
from_asset_id = e.src
from_asset_name = sets.assets[e.src]
to_asset_id = e.dst
to_asset_name = sets.assets[e.dst]
end If you are using the for f ∈ F
from_asset_name = f[1]
to_asset_name = f[2]
end Depending on the information in your function, one option will be more straightforward. @abelsiqueira, any comment, suggestion or thoughts? Thanks! |
With the new data format, I would like to show a directed graph with:
I know how to calculate the export/import caps for flow A->B, but how can I get the reverse direction arrows onto the same graph to label with the import capacity? The graph just thinks there's 1 arrow that can have a positive or negative flow - but I need to show two arrows with their own capacities. |
I could do a non-directed graph and make the labeled capacity be a different color for export/import (or display on a different part of the line), but I think having double arrows is the better solution. |
You will need to create a separate graph for that, since the one we have is indeed only from A to B (unless explicitly declared from B to A in the csv as well). Here is how to construct one such graph using the existing graph: graph
dgraph = DiGraph(nv(graph)) # Creates a graph with the same number of vertices
for e in edges(graph)
add_edge!(dgraph, e.src, e.dst)
add_edge!(dgraph, e.dst, e.src)
end The thing is, |
Create a function to create graph plots and attach information to the graph.
Check https://github.com/JuliaGraphs/NetworkLayout.jl or https://github.com/JuliaGraphs/GraphPlot.jl
The following functions for plots will be added:
The text was updated successfully, but these errors were encountered: