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

Feat: support adding multiple nodes/branches at once (performance increase) #31

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Thijss
Copy link
Contributor

@Thijss Thijss commented Feb 4, 2025

rustworkx supports adding multiple nodes/branches at once. This is much faster than one by one.
I've updated the code to support this.

benefits

This should also increase performance of methods like Graph.from_arrays and Grid.from_cache

side-effects

this introduces some breaking changes since some methods on the BaseGraphModel have been renamed:

  • add_node -> add_node_array
  • add_branch -> add_branch_array
  • add_branch3 -> add_branch3_array

On the other hand, I don't expect this to break many in existing projects, because in general the Graph.add_branch and Graph.add_node functions are not directly used (e.g., Grid.append and Grid.add_node are used instead)

ToDo:

  • needs some extra tests

Performance comparison

Existing code (main):
ExistingCode

New code:
NewCode

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]>
Signed-off-by: Thijs Baaijen <[email protected]>
@Thijss Thijss changed the title Feat/improve performance creating large graphs Feat: support adding multiple nodes/branches at once (performance increase) Feb 4, 2025
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.

1 participant