Jump to content
Adam Ferestad

Wrangle Node Recursion Substitute

Recommended Posts

Ok, so I trying to work up some tests on sorting methods in Houdini and the one that I am playing with right now is supposed to parallelize well and I really want to test it using VEX, but apparently snippets don't currently support recursive algorithms.  This is unfortunate because from what I have seen, several of the methods I want to play with are based on recursives and that basically knocks all of them out unless I can come up with an iterative method of implementing them.  I am working on a Merge Sort found here: https://en.wikipedia.org/wiki/Merge_sort#Top-down_implementation, though looking at the code for the bottom up method reveals that it does not contain any recursion, so I will try to get that one up and running, though the problem remains what ways you all use to get around recursion with iteration for VEX snippets.  I want to get some practice with fractal geometry, and those are basically all recursive, so it is going to become important soon.

Edited by Adam Ferestad

Share this post


Link to post
Share on other sites
1 minute ago, f1480187 said:

You can use Solver SOP instead. In wrangles, you can use while loop and accumulate variables.  VEX does not support recursion other than recursive shader calls.

I saw someone mention the Solver SOP, but wouldn't that defeat the purpose of doing this in VEX and eliminate the parallel implementation that VEX brings?

I also remember reading that Hscript supports it, as does Python, but do they support the parallel computing like VEX?

Share this post


Link to post
Share on other sites

If you use while loop in point wrangle, there won't be any difference except code structure. If you iterate over all points in Detail wrangle, the code does not run in parallel at all.

Share this post


Link to post
Share on other sites

What sort of fractal geometry are you referring to? I have implemented a number of algorithms and they did not involve function recursion, just simply iterating on a value.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×