Skip to content
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

Parallel link properties #51

Open
Lvulis opened this issue Apr 5, 2021 · 1 comment
Open

Parallel link properties #51

Lvulis opened this issue Apr 5, 2021 · 1 comment

Comments

@Lvulis
Copy link
Collaborator

Lvulis commented Apr 5, 2021

RivGraph identifies parallel links for its directionality finding, but it doesn't consider them as parallel links in the delta metrics (adjacency matrix). In the weighted (by width) adjacency matrix it currently gives the weight as the width of one of the links. This may or may not be a problem. An example on a very simple channel network is here.

A prior solution #10 used to introduce additional nodes, although this may not be totally necessary. It depends on the metrics being computed. To have this functionality, for RG object named delt with the initial network skeletonized (but not pruned) use the following (from @jonschwenk) order of operations.

delt.prune_network(path_shoreline=path_shrln, path_inletnodes=path_inlet)
delt.compute_link_width_and_length()
delt.assign_flow_directions()
delt.links, delt.nodes = lnu.add_artificial_nodes(delt.links, delt.nodes, delt.gdobj)
delt.compute_link_width_and_length() # Need to re-compute because we've split some links into 2 in order to add artificial nodes.
adj_w = delt.adjacency_matrix(weight='wid_adj') # Can also weight by 'len_adj' or provide a vector of your own weights.
@jonschwenk
Copy link
Collaborator

True, parallel edges are merged in the networkX representations. The solution here is to use lnu.add_artificial_nodes(), however it is currently not designed to respect flow directions when creating the artificial links. This change should be made, and docs updated to reflect it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants