---
name: "mlpack_tree_BinarySpaceTree_DualTreeTraverser"
section: "3"
platform: "linux"
package: "mlpack-doc"
version: "1.0.10-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/mlpack_tree_BinarySpaceTree_DualTreeTraverser"
---

# mlpack\_tree\_BinarySpaceTree\_DualTreeTraverser(3)

A dual-tree traverser for binary space trees; see dual\_tree\_traverser.hpp.

## NAME

mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \> -

A dual-tree traverser for binary space trees; see dual\_tree\_traverser.hpp.

## SYNOPSIS

### Public Member Functions

**DualTreeTraverser** (RuleType &**rule**)\
 *Instantiate the dual-tree traverser with the given rule set.*  size\_t **NumBaseCases** () const \
 *Get the number of times a base case was calculated.*  size\_t & **NumBaseCases** ()\
 *Modify the number of times a base case was calculated.*  size\_t **NumPrunes** () const \
 *Get the number of prunes.*  size\_t & **NumPrunes** ()\
 *Modify the number of prunes.*  size\_t **NumScores** () const \
 *Get the number of times a node combination was scored.*  size\_t & **NumScores** ()\
 *Modify the number of times a node combination was scored.*  size\_t **NumVisited** () const \
 *Get the number of visited combinations.*  size\_t & **NumVisited** ()\
 *Modify the number of visited combinations.*  void **Traverse** (**BinarySpaceTree** &queryNode, **BinarySpaceTree** &referenceNode)\
 *Traverse the two trees.*

### Private Attributes

size\_t **numBaseCases**\
 *The number of times a base case was calculated.*  size\_t **numPrunes**\
 *The number of prunes.*  size\_t **numScores**\
 *The number of times a node combination was scored.*  size\_t **numVisited**\
 *The number of node combinations that have been visited during traversal.*  RuleType & **rule**\
 *Reference to the rules with which the trees will be traversed.*  RuleType::TraversalInfoType **traversalInfo**\
 *Traversal information, held in the class so that it isn't continually being reallocated.*

## Detailed Description

### template\<typename BoundType, typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\>template\<typename RuleType\>class mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>

A dual-tree traverser for binary space trees; see dual\_tree\_traverser.hpp.

Definition at line 103 of file binary\_space\_tree.hpp.

## Constructor & Destructor Documentation

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::DualTreeTraverser (RuleType &rule)

Instantiate the dual-tree traverser with the given rule set.

## Member Function Documentation

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::NumBaseCases () const` [inline]`

Get the number of times a base case was calculated.

Definition at line 75 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t& mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::NumBaseCases ()` [inline]`

Modify the number of times a base case was calculated.

Definition at line 77 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::NumPrunes () const` [inline]`

Get the number of prunes.

Definition at line 60 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t& mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::NumPrunes ()` [inline]`

Modify the number of prunes.

Definition at line 62 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::NumScores () const` [inline]`

Get the number of times a node combination was scored.

Definition at line 70 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t& mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::NumScores ()` [inline]`

Modify the number of times a node combination was scored.

Definition at line 72 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::NumVisited () const` [inline]`

Get the number of visited combinations.

Definition at line 65 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t& mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::NumVisited ()` [inline]`

Modify the number of visited combinations.

Definition at line 67 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> void mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::Traverse (BinarySpaceTree &queryNode, BinarySpaceTree &referenceNode)

Traverse the two trees. This does not reset the number of prunes.

**Parameters:**

*queryNode* The query node to be traversed. \
 *referenceNode* The reference node to be traversed. \
 *score* The score of the current node combination.

## Member Data Documentation

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::numBaseCases` [private]`

The number of times a base case was calculated.

Definition at line 93 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::numPrunes` [private]`

The number of prunes.

Definition at line 84 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::numScores` [private]`

The number of times a node combination was scored.

Definition at line 90 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> size\_t mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::numVisited` [private]`

The number of node combinations that have been visited during traversal.

Definition at line 87 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> RuleType& mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::rule` [private]`

Reference to the rules with which the trees will be traversed.

Definition at line 81 of file dual\_tree\_traverser.hpp.

### template\<typename BoundType , typename StatisticType = EmptyStatistic, typename MatType = arma::mat, typename SplitType = MeanSplit\<BoundType, MatType\>\> template\<typename RuleType \> RuleType::TraversalInfoType mlpack::tree::BinarySpaceTree\< BoundType, StatisticType, MatType, SplitType \>::DualTreeTraverser\< RuleType \>::traversalInfo` [private]`

Traversal information, held in the class so that it isn't continually being reallocated.

Definition at line 97 of file dual\_tree\_traverser.hpp.

## Author

Generated automatically by Doxygen for MLPACK from the source code.
