Skip to content

Feature/improved welding#157

Draft
p-snft wants to merge 9 commits intodevfrom
feature/improved_welding
Draft

Feature/improved welding#157
p-snft wants to merge 9 commits intodevfrom
feature/improved_welding

Conversation

@p-snft
Copy link
Member

@p-snft p-snft commented Dec 2, 2025

The current graph pre-processing code has the problem that it keeps detours if there are forks on the shorter path. Further, the current "welding" code is slow. This PR is to tackle both, using networkx as a vehicle for efficient graph algorithms.

p-snft and others added 6 commits December 2, 2025 14:28
The newly introduced functions now return if the graph was updated.
The change from _weld_edges to _remove_useless_forks also removes dead
ends. Note that they require an attribute "type" to make the funtion work.
@jnettels
Copy link
Contributor

jnettels commented Dec 9, 2025

Hi, thanks for all the hard work updating the project!
I just noticed this PR and want to compare it to the old welding, which really is very slow. I hope I find the time to test it. Will you let me know when it is ready to test?

Just from a quick glance, it seems like the new go.drop_detours(lines_all) may have the same purpose as the existing lines = go.drop_parallel_lines(lines). The old one does not need a for-loop. I wonder which one is faster.

@p-snft
Copy link
Member Author

p-snft commented Dec 10, 2025

Just from a quick glance, it seems like the new go.drop_detours(lines_all) may have the same purpose as the existing lines = go.drop_parallel_lines(lines). The old one does not need a for-loop. I wonder which one is faster.

The old approach just deleted strictly parallel lines, i.e. two nodes where connected by more than one edge without additional edges in between. The new one removes detours even if the shorter connection consists of multiple segments, like in the following example:

detour

Note that drop_parallel_lines fails here because the shorter connection has forks connecting consumers.

p-snft and others added 3 commits December 15, 2025 20:35
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

Successfully merging this pull request may close these issues.

2 participants