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

Parallelize cycle finding #77

Open
ZevEisenberg opened this issue Jan 12, 2020 · 3 comments
Open

Parallelize cycle finding #77

ZevEisenberg opened this issue Jan 12, 2020 · 3 comments

Comments

@ZevEisenberg
Copy link
Contributor

Would it be possible to speed up detectCycles and detectCyclesAsEdges by making them run parts of the search in parallel? I don't know whether the algorithm is suitable for parallelization, but it could be worth looking into.

Background: I've been modifying my juggling code to deal with throwing multiple objects at the same time, and the state graphs for this technique are way bigger than for throwing a single object at once. For 3 balls, for a maximum throw height of 6, there are 110,552 cycles in the graph. I don't know how many there are for a maximum throw height of 7 because I haven't been able to run the code for long enough yet to find out.

For graphs this large, memory usage is also a concern. My current test run searching for a max throw height of 7 is up over 1 GB used.

(Much of this is academic. I don't know if I have a real-world use case for searching for cycles on graphs this large, at least not quickly. If my app needs to use them, I'll probably generate them once and bake them into the app.)

@davecom
Copy link
Owner

davecom commented Jan 14, 2020

Hi @ZevEisenberg,
We are currently using an easy to implement cycle-detection algorithm that also allows us to limit detection to cycles of a certain length. However, there are much more performant algorithms out there. We would probably get more bang for the buck operating on large graphs by implementing one of these other algorithms (even if single-threaded) than we would by working on parallelizing the existing implementation.
Best,
Dave

@dabbott
Copy link
Contributor

dabbott commented Mar 27, 2020

Related: #79

I think there are some quick improvements that could be made to detectCycles that'd improve speed and memory usage a lot - mainly memoizing the results of neighborsForVertex and indexOfVertex, and using indices instead of vertices where possible.

@davecom
Copy link
Owner

davecom commented Mar 27, 2020

@dabbott No doubt you're right! Good call.

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

No branches or pull requests

3 participants