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 dorogovtsev mendes #371

Merged
merged 6 commits into from
May 1, 2024

Conversation

AntoineBut
Copy link
Contributor

@AntoineBut AntoineBut commented Apr 29, 2024

Addresses #370.

This implementation has $O(N)$ runtime, while the previous implementation had $O(N^2)$ runtime.

The optimization comes from storing all edges added at each iteration in an indexed table, allowing to draw a random edge in $O(1)$ time, while the previous implementation had to go through (on average) half on the nodes in order to draw a random edge, which takes $O(N)$ time.

On my computer, this implementation uses approximately 16% more memory.

It runs faster than the previous one even on small graphs ($N = 100$).

Copy link

codecov bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.28%. Comparing base (afb8245) to head (b42ab1f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #371   +/-   ##
=======================================
  Coverage   97.28%   97.28%           
=======================================
  Files         118      118           
  Lines        6876     6876           
=======================================
  Hits         6689     6689           
  Misses        187      187           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gdalle
Copy link
Member

gdalle commented Apr 29, 2024

Failures on nightly are expected

Copy link
Member

@gdalle gdalle left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, this is nearly good to go!

As suggested

Co-authored-by: Guillaume Dalle <[email protected]>
@gdalle gdalle merged commit 48c42c7 into JuliaGraphs:master May 1, 2024
9 of 12 checks passed
@AntoineBut AntoineBut deleted the ab/faster-dorogovtsev_mendes branch May 2, 2024 18:26
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