StackOverflowError in findSimpleCycles
See original GitHub issue * JGraphT version:1.4.0
* Java version (java -version)/platform: OpenJDK Runtime Environment Corretto-8.252.09.2 (build 1.8.0_252-b09) for Windows 10 x64
Issue I am trying to list all cycles in a very large sparse graph. I tried JohnsonSimpleCycles.findSimpleCycles() but it quickly generates a java.lang.StackOverflowError. The stacktrace shows a lot of calls “at org.jgrapht.alg.cycle.JohnsonSimpleCycles.getSCCs(JohnsonSimpleCycles.java:207)” that corresponds to the recursive call “getSCCs(startIndex, successorIndex);” I tried:
- increasing the stack size with -Xss8g,
- decreasing the dimension of graph using Long for vertexes instead of String for vertexes
- changing the algorithm to SzwarcfiterLauerSimpleCycles and HawickJamesSimpleCycles, but the result is always the same.
Steps to reproduce (small coding example) I attach the source and the data files to reproduce the issue.
Expected behaviour No StackOverflowError graph.zip
Other information I think the only way to remove the problem is rewriting the getSCCs function in an iterative way instead of the actual recursive way.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
Why do I get StackOverFlowError when trying to DFS this ...
There are two possible explanations: There is a loop and your loop detection code isn't working. The graph is too deep; i.e. your...
Read more >jgrapht - Bountysource
findSimpleCycles () but it quickly generates a java.lang.StackOverflowError. The stacktrace shows a lot of calls "at org.jgrapht.alg.cycle.
Read more >The StackOverflowError in Java - Baeldung
Learn how one of Java's most common errors - StackOverflowError - occurs, and how to resolve it.
Read more >[#MNG-6737] StackOverflowError when version ranges are ...
Maven throws StackOverflowError when version ranges are unsolvable and the dependency graph contains a cycle. $ mvn install .
Read more >StackOverflowException due to insufficient Java stack - IBM
I am seeing java.lang.StackOverflowError while running the application. Why am I getting this error and how can I prevent it?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JZamboni I implemented a non-recursive version of Gabow’s algorithm. In case you need it urgently, my implementation can be found here: https://github.com/jkinable/jgrapht/blob/gabow/jgrapht-core/src/main/java/org/jgrapht/alg/connectivity/GabowStrongConnectivityInspector.java
Sadly, we broke the performance testing framework (see issue #1047 ) during the last release. Until we figure out how to mend the performance testing suite, I can’t compare the non-recursive implementation with the old recursive implementation. I’ll hold off a PR until I know how the new implementation compares against the old one.
@jkinable Thanks for the quick reply and implementation! I have tested it with my graph and the issue is gone.