[−][src]Module splashsurf_lib::generic_tree
Generic tree visitation functions that can be used with tree-like structures
In order to use these algorithms, the data structure has to implement the TreeNode
and for
mutable access the TreeNodeMut
trait. These traits only require to give access to a slice
of child nodes of a node.
This module provides algorithms for breadth-first and depth-first visitation. Overview of the traits:
VisitableTree
provides non-mutable sequential iteration.MutVisitableTree
provides sequential visitation using a visitor function with mutable access to the current node.ParVisitableTree
provides parallel visitation using a visitor function, parallelized using rayon.ParMutVisitableTree
provides parallel visitation using a visitor function with mutable access to the current node, parallelized using rayon.
Note that the mutation of nodes during visitation is safe as the mutation is only possible either before the children are enqueued or after the children were already processed.
Structs
BfsIter | Breadth-first search iterator returned by the |
DfsIter | Depth-first search iterator returned by the |
Traits
MutVisitableTree | Trait for sequential tree visitation algorithms that support mutation during visitation. Automatically implemented for types that implement |
ParMutVisitableTree | Trait for mutable parallel tree visitation algorithms. Automatically implemented for types that implement |
ParVisitableTree | Trait for non-mutable parallel tree visitation algorithms. Automatically implemented for types that implement |
TreeNode | Trait that has to be implemented by tree-like structures to make them visitable |
TreeNodeMut | Trait that has to be implemented by tree-like structures to visit and mutate them |
VisitableTree | Trait for non-mutable sequential tree iteration algorithms. Automatically implemented for types that implement |