Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Reduced time & memory footprint for Tarjans algorithm, fixed a bug where it was O(E^2) on star graphs. #1559

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Commits on Apr 11, 2021

  1. 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
    saolof authored Apr 11, 2021
    Configuration menu
    Copy the full SHA
    4fd170e View commit details
    Browse the repository at this point in the history

Commits on Apr 12, 2021

  1. Update connectivity.jl

    spelled function name correctly
    saolof authored Apr 12, 2021
    Configuration menu
    Copy the full SHA
    1e9dd73 View commit details
    Browse the repository at this point in the history
  2. Update connectivity.jl

    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.
    saolof authored Apr 12, 2021
    Configuration menu
    Copy the full SHA
    eaf1946 View commit details
    Browse the repository at this point in the history
  3. Update connectivity.jl

    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.
    saolof authored Apr 12, 2021
    Configuration menu
    Copy the full SHA
    9308b9e View commit details
    Browse the repository at this point in the history
  4. Update src/connectivity.jl

    Co-authored-by: Simon Schoelly <[email protected]>
    saolof and simonschoelly authored Apr 12, 2021
    Configuration menu
    Copy the full SHA
    705b925 View commit details
    Browse the repository at this point in the history
  5. Update connectivity.jl

    Previous commit removed the if in front of iszero somehow
    saolof authored Apr 12, 2021
    Configuration menu
    Copy the full SHA
    3427221 View commit details
    Browse the repository at this point in the history

Commits on Apr 13, 2021

  1. Update connectivity.jl

    Slightly simplified logic and removed the need for zero_t.
    saolof authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    156793a View commit details
    Browse the repository at this point in the history
  2. Update connectivity.jl

    Trying to figure out what broke. Can elements of outneighbours be equal to nothing?
    saolof authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    234ace4 View commit details
    Browse the repository at this point in the history
  3. Update connectivity.jl

    testing
    saolof authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    9169d80 View commit details
    Browse the repository at this point in the history
  4. Update connectivity.jl

    Set correct name on method
    saolof authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    b441446 View commit details
    Browse the repository at this point in the history
  5. Update connectivity.jl

    Added comments.
    saolof authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    c30cb2d View commit details
    Browse the repository at this point in the history
  6. Update connectivity.jl

    Added a dispatch to infer the types.
    saolof authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    b0953f1 View commit details
    Browse the repository at this point in the history
  7. Update connectivity.jl

    saolof authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    810c91f View commit details
    Browse the repository at this point in the history
  8. Update connectivity.jl

    saolof authored Apr 13, 2021
    Configuration menu
    Copy the full SHA
    97edcbd View commit details
    Browse the repository at this point in the history

Commits on Apr 14, 2021

  1. Configuration menu
    Copy the full SHA
    336107f View commit details
    Browse the repository at this point in the history
  2. Changed rindex to be T valued

    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
    saolof authored Apr 14, 2021
    Configuration menu
    Copy the full SHA
    ce1c9ae View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2021

  1. added spaces after commas

    saolof authored Apr 15, 2021
    Configuration menu
    Copy the full SHA
    c60466d View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2021

  1. Configuration menu
    Copy the full SHA
    008da10 View commit details
    Browse the repository at this point in the history

Commits on May 13, 2021

  1. Configuration menu
    Copy the full SHA
    3a97777 View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2021

  1. Configuration menu
    Copy the full SHA
    4b79f3b View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2021

  1. Configuration menu
    Copy the full SHA
    ebb392b View commit details
    Browse the repository at this point in the history