I have tried to figure out how to use Reap and Sow from searching online, but do not understand it. Can anyone help me with my line of code? The issue is that the data set is so large that it takes a very long time to compute.
I currently have a list that has just over 623,000 elements in it.
My code to then loop through the list to determine the VertexDegree and then store those elements in a new list is:
But it returns Null when I know that it should have least one element. So, I am hoping that someone can quickly tell me how to get Reap/Sow to work instead of AppendTo. I am sorry if this is super simple and annoying, but I can’t figure it out.
Thank you so much.
Sow works like this – you don’t append to the list – it just collects the values. I do not recommend this in your case because you want a value returned for every element in your cyclelist
Sorry, Crossed with Kuda’s post at the same time… I would also time Kuda’s table approach to see if it is faster than the loop and/or the Map. Curious to know which is faster.
(Also, if you compile the function you will probably get a significant speedup with any of the approaches)
Wow. I am so glad I posted this question. All three solutions worked much faster than my original part. The first Table implementation took 65.9754. The second that uses some mapping code I don’t understand took 64.1661. And the One that uses the Map function name took 63.4734! Thank you both for you help. I will try to read more about Table and Map since I didn’t understand how to use them before.