![]() |
parallel tree traversal in C# - Printable Version +- tyFlow Forum (https://forum.tyflow.com) +-- Forum: tyFlow Discussion (https://forum.tyflow.com/forum-1.html) +--- Forum: General Discussion (https://forum.tyflow.com/forum-2.html) +--- Thread: parallel tree traversal in C# (/thread-2400.html) |
parallel tree traversal in C# - Geoff - 05-16-2021 Hey Tyson, I'm currently trying to write a multi-threaded function to traverse a tree structure. The function is called continuously and compute various values, like tree height, node depth, children sum, etc. Most algorythms I found on the web for parallel tree traversal, start from the root, so I need to convert the flat list of particleIDs/parentIDs to a nested tree stucture of objects with a children list property. I use a concurrentDictionary to grab the parenting refs based on ids. For now the performances are not that great :/ using your threaded function or a parallelForeach function give me approximatively the same results. I was wondering if your bind search functions or your recursive child count function in the propertyTest operator were multi-threaded? and how would you approach the parallel "flat list to tree" and tree traversal problems..? here is the method I use with concurrentDictionary to build the tree structure: ![]() ps: couldn't add a .cs attachement and can't even type code on forum posts.. |