Skip to content

Parallel Walks

Latest
Compare
Choose a tag to compare
@orxfun orxfun released this 07 Jun 19:05
· 2 commits to main since this release
ddb2d0b

Parallelized Walks

  • The main contribution of this release is enabling parallel iterators over various tree iterators and walks with any of the traversals. Parallelization is obtained simply by adding _par suffix to name of the sequential counterpart. These methods return a orx_parallel::ParIter which allows for significant improvements in computation time. The following is the list of new methods returning parallel iterators:
    • children_par
    • ancestors_par
    • custom_walk_par
    • walk_par
    • walk_with_par
    • paths_par
    • paths_with_par
    • leaves_par
    • leaves_with_par

Custom Walks

  • custom_walk(next_node) method is implemented. This method returns an iterator over the nodes with custom traversal strategy. Traversal strategy is determined by the argument next_node. next_node is a function with the signature Fn(Node) -> Option<Node>. Iteration starts with the self and terminates when next_node returns None. This provides a convenient and flexible way to create custom walks. Notice that iteration in all directions can be defined and infinite iterations can be created. Mutable version custom_walk_mut(next_node) is also implemented for NodeMut.

Allocation-Free Paths Iterator

  • paths was returning impl Iterator<Item = impl Iterator<&V::Item>>. Now it returns impl Iterator<Item = impl Iterator<&V::Item> + Clone>. In other words, each path element is a cheaply cloneable iterator. This allows for converting the path into_iterable which can be iterated over multiple times, and hence, provides the means to avoid allocation and collecting the paths into collections.
  • Examples for different iterators, walks are added and linked from the documentation.