Reuse split vertices at same coordinates #5985
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR prevents recreating multiple permanent split vertices at the same coordinate.
Note: this fix is an alternative to #5956, which tries to prevent u-turns by adding costs for u-turns.
Issue
As described in #5955, linking currently creates multiple split vertices for forward and backward edges.
This PR lets
VertexLinker
keep track of split vertices during graph build and reuses an existing split vertex, if it has the same coordinates as the split coordinates for a different edge.Closes #5955
Unit tests
A couple of test cases testing the number of created vertices/edges were adapted to reflect the reduced count of edges/nodes.
In addition, this PR provides a test case to illustrate #5955.