Skip to content

fix/bridge detection for parallel branches - #145

Open
JoostvanDijkTenneT wants to merge 6 commits into
eliagroup:mainfrom
JoostvanDijkTenneT:fix/bug-bridge-detection
Open

JoostvanDijkTenneT wants to merge 6 commits into
eliagroup:mainfrom
JoostvanDijkTenneT:fix/bug-bridge-detection

Conversation

@JoostvanDijkTenneT

Copy link
Copy Markdown

Checklist

Please check if the PR fulfills these requirements:

  • [ Yes] PR Title follows conventional commit messages
  • [ Yes] Tests for the changes have been added (for bug fixes / features)
  • [ Not relevant] Docs have been added / updated (for bug fixes / features)
  • [ Yes] All commits in this PR are DCO signed-off (see CONTRIBUTING.md)

Does this PR already have an issue describing the problem?

No.

Fixes

Parallel branches which would cause two connected components when removed from the graph are now marked as a bridge. This PR fixes that.

Does this PR introduce a breaking change?

  • [ ] Yes
  • [ X] No

@JoostvanDijkTenneT
JoostvanDijkTenneT marked this pull request as ready for review November 4, 2026 15:10
Copilot AI balanced review requested due to automatic review settings November 4, 2026 15:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The obsolete sparse import and number_edges assignment trigger Ruff F401/F841 violations in CI pre-commit checks and must be removed.

1 open issue
What changed in this PR

This PR corrects bridge detection during network preprocessing so parallel branches are not incorrectly treated as individual bridges.

Changes:

  • Uses a NetworkX MultiGraph to preserve parallel edges.
  • Adds a regression test for two parallel branches.
  • Cleans up LODF tests and relaxes the voltage-angle comparison tolerance.
File Description
tests/​preprocess/​test_helper_functions.py Adds regression coverage for parallel branches.
tests/​numpy/​test_lodf.py Removes unused variables, corrects spelling, and adjusts angle tolerance.
src/​dc_plus/​preprocess/​helper_functions.py Replaces sparse-matrix graph construction with a multigraph.

Review effort: Balanced

Signed-off-by: Dijk <Joost.van.Dijk@tennet.eu>
Signed-off-by: Dijk <Joost.van.Dijk@tennet.eu>
…some computers).

Signed-off-by: Dijk <Joost.van.Dijk@tennet.eu>
Signed-off-by: Dijk <Joost.van.Dijk@tennet.eu>
Signed-off-by: Dijk <Joost.van.Dijk@tennet.eu>
Signed-off-by: Dijk <Joost.van.Dijk@tennet.eu>

This branch has not been deployed

No deployments
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