Trait outils::tree::traversal::Traversable [−][src]
pub trait Traversable<V, Ix = DefaultIndexType> where
V: ValueType,
Ix: IndexType, { fn root(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>; fn value(&self, node: NodeIndex<Ix>) -> Option<&V>; fn value_mut(&mut self, node: NodeIndex<Ix>) -> Option<&mut V>; fn parent(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>; fn child(&self, node: NodeIndex<Ix>, pos: usize) -> Option<NodeIndex<Ix>>; fn child_count(&self, node: NodeIndex<Ix>) -> usize; fn node_count(&self) -> usize; }
This trait defines the interface for using the traversal iterators provided by this module.
Required Methods
fn root(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>
Returns the index of the root node of the tree containing the tree node indexed by node
.
fn value(&self, node: NodeIndex<Ix>) -> Option<&V>
Immutably access the value stored in the tree node indexed by node
.
fn value_mut(&mut self, node: NodeIndex<Ix>) -> Option<&mut V>
Mutably access the value stored in the tree node indexed by node
.
fn parent(&self, node: NodeIndex<Ix>) -> Option<NodeIndex<Ix>>
Returns the index of parent node tree node indexed by node
.
fn child(&self, node: NodeIndex<Ix>, pos: usize) -> Option<NodeIndex<Ix>>
Returns the index of the child node at position pos
of the tree node indexed by node
.
fn child_count(&self, node: NodeIndex<Ix>) -> usize
Returns the number of child nodes of the tree node indexed by node
.
fn node_count(&self) -> usize
Returns the total number of tree nodes of the tree self
.
Implementors
impl<V> Traversable<V> for AaForest<V> where
V: ValueType,impl<K, V> Traversable<V> for AaTree<K, V> where
K: KeyType,
V: ValueType,impl<V, W> Traversable<V> for WeightedAaForest<V, W> where
V: ValueType,
W: WeightType,impl<K, V, W> Traversable<V> for WeightedAaTree<K, V, W> where
K: KeyType,
V: ValueType,
W: WeightType,impl<V> Traversable<V> for Forest<V> where
V: ValueType,