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

Faster all_neighbors for SimpleDiGraphs #82

Merged
merged 1 commit into from Jan 9, 2022

Conversation

etiennedeg
Copy link
Member

Credits to @abhinavmehndiratta
This was part of the 2.0.0-dev branch on LightGraphs but never made it into master.
I changed it to make it even faster, so a quick review but that should be ok.

@codecov
Copy link

codecov bot commented Dec 23, 2021

Codecov Report

Merging #82 (8711137) into master (761912f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #82   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files         107      107           
  Lines        5556     5622   +66     
=======================================
+ Hits         5526     5592   +66     
  Misses         30       30           

Copy link
Contributor

@simonschoelly simonschoelly left a comment

Choose a reason for hiding this comment

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

Thanks, this one makes totally sense. There is a weak assumption that vertices are always sorted incrementally for any kind of graph type, so in the future we could also discuss extending this to other types of directed graphs.

Another idea would be to use a non-allocating iterator here, although then calculating length would be a bit more difficult - either we don't calculate it and might break some user code or we precalculate length by by doing a a pass over all vertices when constructing the iterator.

@simonschoelly simonschoelly merged commit c5844a1 into JuliaGraphs:master Jan 9, 2022
@etiennedeg
Copy link
Member Author

Making it an iterator was discussed but @sbromberger thought it would be inconsistent with other neighbor functions, so I kept it like this. I added the reference to the previous commit.

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.

None yet

2 participants