This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 185
Reduced time & memory footprint for Tarjans algorithm, fixed a bug where it was O(E^2) on star graphs. #1559
Open
saolof
wants to merge
21
commits into
sbromberger:master
Choose a base branch
from
saolof:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Apr 11, 2021
-
Reduced time & memory footprint for Tarjans algorithm
I worked on improving the strongly_connected_components function in this graph. This PR eliminates several of the arrays that were used for auxiliary data using various tricks inspired by https://homepages.ecs.vuw.ac.nz/~djp/files/IPL15-preprint.pdf , which reduces memory usage & allocations and improves cache efficiency. This seems to lead to a speedup in every category of random graphs in benchmarking. I would also subjectively claim that this version of the algorithm is more easily readable than Tarjan's original version. Also put up a gist of a few alternatives I tried out: https://gist.github.com/saolof/7b5d26a41e6a34ff2b3e76d3fc5541da
Configuration menu - View commit details
-
Copy full SHA for 4fd170e - Browse repository at this point
Copy the full SHA 4fd170eView commit details
Commits on Apr 12, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 1e9dd73 - Browse repository at this point
Copy the full SHA 1e9dd73View commit details -
Counting downwards instead of upwards has the advantage that rindex becomes a lookup table for components, if we ever decide to return both. Also makes the algorithm invariant crystal clear.
Configuration menu - View commit details
-
Copy full SHA for eaf1946 - Browse repository at this point
Copy the full SHA eaf1946View commit details -
Fixed O(|E|^2) performance bug that used to be an issue for star graphs. Minimal change in performance for large random graphs, but significant speedup for graphs that have both lots of SCCs and high node orders.
Configuration menu - View commit details
-
Copy full SHA for 9308b9e - Browse repository at this point
Copy the full SHA 9308b9eView commit details -
Co-authored-by: Simon Schoelly <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 705b925 - Browse repository at this point
Copy the full SHA 705b925View commit details -
Previous commit removed the if in front of iszero somehow
Configuration menu - View commit details
-
Copy full SHA for 3427221 - Browse repository at this point
Copy the full SHA 3427221View commit details
Commits on Apr 13, 2021
-
Slightly simplified logic and removed the need for zero_t.
Configuration menu - View commit details
-
Copy full SHA for 156793a - Browse repository at this point
Copy the full SHA 156793aView commit details -
Trying to figure out what broke. Can elements of outneighbours be equal to nothing?
Configuration menu - View commit details
-
Copy full SHA for 234ace4 - Browse repository at this point
Copy the full SHA 234ace4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9169d80 - Browse repository at this point
Copy the full SHA 9169d80View commit details -
Configuration menu - View commit details
-
Copy full SHA for b441446 - Browse repository at this point
Copy the full SHA b441446View commit details -
Configuration menu - View commit details
-
Copy full SHA for c30cb2d - Browse repository at this point
Copy the full SHA c30cb2dView commit details -
Configuration menu - View commit details
-
Copy full SHA for b0953f1 - Browse repository at this point
Copy the full SHA b0953f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 810c91f - Browse repository at this point
Copy the full SHA 810c91fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 97edcbd - Browse repository at this point
Copy the full SHA 97edcbdView commit details
Commits on Apr 14, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 336107f - Browse repository at this point
Copy the full SHA 336107fView commit details -
Changed everything to be T-valued. Partly to save space for small graphs represented using smaller types, and partly for correctness on machines where Int = Int32 and where the graph is large enough to require Int64s
Configuration menu - View commit details
-
Copy full SHA for ce1c9ae - Browse repository at this point
Copy the full SHA ce1c9aeView commit details
Commits on Apr 15, 2021
-
Configuration menu - View commit details
-
Copy full SHA for c60466d - Browse repository at this point
Copy the full SHA c60466dView commit details
Commits on Apr 16, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 008da10 - Browse repository at this point
Copy the full SHA 008da10View commit details
Commits on May 13, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 3a97777 - Browse repository at this point
Copy the full SHA 3a97777View commit details
Commits on Jun 4, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 4b79f3b - Browse repository at this point
Copy the full SHA 4b79f3bView commit details
Commits on Jun 5, 2021
-
Configuration menu - View commit details
-
Copy full SHA for ebb392b - Browse repository at this point
Copy the full SHA ebb392bView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.