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

Feature: add tmp_remove_nodes method to graph #17

Open
wants to merge 14 commits into
base: release1_1
Choose a base branch
from

Conversation

Thijss
Copy link
Contributor

@Thijss Thijss commented Jan 23, 2025

Adds a context manager for temporarily removing nodes from the graph.

This can for instance be useful when trying to calculate the shortest path between two nodes without considering certain nodes in the graph.

@Thijss Thijss changed the title Feat/tmp remove nodes Feature: add tmp_remove_nodes method to graph Jan 23, 2025
Thijss and others added 3 commits January 23, 2025 16:19
Signed-off-by: Thijs Baaijen <[email protected]>
Signed-off-by: Thijs Baaijen <[email protected]>
@Thijss Thijss force-pushed the feat/tmp-remove-nodes branch from a918336 to 45780e7 Compare January 23, 2025 15:19
@Thijss Thijss added the v1.1 label Jan 23, 2025
@Thijss Thijss self-assigned this Jan 23, 2025
Thijss and others added 4 commits January 24, 2025 12:40
Co-authored-by: Vincent Koppen <[email protected]>
Signed-off-by: Thijs Baaijen <[email protected]>
Signed-off-by: Thijs Baaijen <[email protected]>
Signed-off-by: Thijs Baaijen <[email protected]>
Signed-off-by: Thijs Baaijen <[email protected]>
@Thijss Thijss force-pushed the feat/tmp-remove-nodes branch from 3a10746 to e0fbce0 Compare January 28, 2025 09:48
@Thijss Thijss changed the base branch from feat/add-all-branches-property to release1_1 January 28, 2025 09:59
@@ -63,6 +73,14 @@ def has_node(self, node_id: int) -> bool:

return self._has_node(node_id=internal_node_id)

def in_edges(self, node_id: int) -> Generator[tuple[int, int], None, None]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

perhaps it is better to call it in_branches?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think in_branches is better. More consistent with the other public functions.

Signed-off-by: Thijs Baaijen <[email protected]>
@Thijss Thijss force-pushed the feat/tmp-remove-nodes branch from a960d8d to 369498b Compare January 28, 2025 10:04
Copy link
Contributor

@vincentkoppen vincentkoppen left a comment

Choose a reason for hiding this comment

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

Looks good, some small points.

@@ -63,6 +73,14 @@ def has_node(self, node_id: int) -> bool:

return self._has_node(node_id=internal_node_id)

def in_edges(self, node_id: int) -> Generator[tuple[int, int], None, None]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think in_branches is better. More consistent with the other public functions.

src/power_grid_model_ds/_core/model/graphs/models/base.py Outdated Show resolved Hide resolved
src/power_grid_model_ds/_core/model/graphs/models/base.py Outdated Show resolved Hide resolved
@Thijss Thijss force-pushed the feat/tmp-remove-nodes branch 2 times, most recently from e70bae8 to 39730c0 Compare January 28, 2025 15:45
Signed-off-by: Thijs Baaijen <[email protected]>
@Thijss Thijss force-pushed the feat/tmp-remove-nodes branch from 39730c0 to e81346f Compare January 28, 2025 15:46
@Thijss Thijss force-pushed the feat/tmp-remove-nodes branch from 676fd30 to c93cd2f Compare February 4, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants