question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FloydWarshall is very memory inefficient

See original GitHub issue

Further to our sending Dijkstra out to lunch:

FloydWarshall starts with:

    // init the backtrace matrix
    backtrace = new Object[n][n];

You know what’s coming next 😀 Let’s assume that N = 586165 (our “small” graph):

586165 * 586165 * 8 // on a 64-bit machine
2748715257800 // bytes
./1048576
2621379 // megabytes...
./1024
2559 // gigabytes ...

Since our graph is directed and largely acyclic, I think we can do much better. Interestingly, we haven’t even hit hash tables, this is a straight array. So, raising a ticket as a placeholder while we figure this out.

It looks like a lovely candidate for a ForkJoinPool, too.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jsichicommented, Jul 16, 2018

(I think the duplicated code noted by @shevek has finally been removed in #630.)

0reactions
jsichicommented, Jul 17, 2018

I’ve merged #632. Remaining items here are:

  • fastutil variant
  • Alternative all-pairs algorithms for special cases (e.g. integer edges) where sub-cubic bounds are known; these should be addressed in their own issues.
  • Cases where the outer loop can terminate early; I do not believe this is applicable in general, but this may be relevant for some of the special cases (like in TransitiveClosure).

Anything else?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unreasonable memory usage for JohnsonShortestPaths? #626
The Floyd-Warshall implementation is very efficient storage-wise, using one map from vertices to integers and then only 2 arrays (with n^2 ...
Read more >
Improving The Floyd-Warshall All Pairs Shortest Paths ... - arXiv
Thus, in general the Floyd-Warshall algorithm becomes very inefficient especially for sparse graphs. In this paper, we show a simple.
Read more >
Time complexity of Floyd Warshall algorithm - Stack Overflow
Therefore the time complexity comes out to be O(v^3) but with a very small constant value, making it extremely viable during implementation. So ......
Read more >
Solving All Pairs Shortest Paths in Parallel
Taking advantage of locality is extremely important in this case, as Floyd-Warshall's algorithm is memory bound. Besides the dependencies between iterations ...
Read more >
A Memory Access Model for Highly-threaded Many-core ...
memory-access latency and validates the intuition that the Floyd-Warshall algorithm performs ... count the number of memory transfers from slow memory to.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found