Skip to content

improve get_neighbors performance - #302

Merged
bobluppes merged 1 commit into
bobluppes:mainfrom
lili2012:main
Sep 1, 2026
Merged

bobluppes merged 1 commit into
bobluppes:mainfrom
lili2012:main

Conversation

@lili2012

@lili2012 lili2012 commented Jan 18, 2026

Copy link
Copy Markdown

I use graaf a lot and change get_neighbors my executable run time drop from 700s to 60s. Hope you could accept it. Thanks!

@github-actions github-actions Bot 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.

Hi there! Thank you for creating your first pull-request on the Graaf library :)

@github-actions

Copy link
Copy Markdown
Contributor

Marking this PR as stale. It will not be automatically closed.

Even though the maintainers of Graaf may not always have time to take a look in a timely fashion, your contributions are much appreciated.
Please allow some time for @bobluppes to take a closer look.

@github-actions github-actions Bot added the stale label Feb 18, 2026
@github-actions github-actions Bot removed the stale label Mar 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Marking this PR as stale. It will not be automatically closed.

Even though the maintainers of Graaf may not always have time to take a look in a timely fashion, your contributions are much appreciated.
Please allow some time for @bobluppes to take a closer look.

@github-actions github-actions Bot added the stale label Apr 19, 2026

@bobluppes bobluppes left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for this — great catch, and a very reasonable optimization! Verified locally: builds cleanly against current main, all 752 existing tests pass (including the dedicated GetNeighbors coverage for both directed and undirected graphs), and clang-format clean. The reference-lifetime tradeoff (the returned reference is tied to the graph's internal state until that vertex is removed) matches the existing pattern already used by get_vertex()/get_edge() in this class, so this is consistent with the rest of the API. Merging, thanks again for contributing!

@bobluppes
bobluppes merged commit 886ca2b into bobluppes:main Sep 1, 2026
1 check passed
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