MLPACK  1.0.8
dual_tree_traverser.hpp
Go to the documentation of this file.
1 
22 #ifndef __MLPACK_CORE_TREE_COVER_TREE_DUAL_TREE_TRAVERSER_HPP
23 #define __MLPACK_CORE_TREE_COVER_TREE_DUAL_TREE_TRAVERSER_HPP
24 
25 #include <mlpack/core.hpp>
26 #include <queue>
27 
28 namespace mlpack {
29 namespace tree {
30 
32 template<typename MetricType, typename RootPointPolicy, typename StatisticType>
34 
35 template<typename MetricType, typename RootPointPolicy, typename StatisticType>
36 template<typename RuleType>
37 class CoverTree<MetricType, RootPointPolicy, StatisticType>::DualTreeTraverser
38 {
39  public:
43  DualTreeTraverser(RuleType& rule);
44 
51  void Traverse(CoverTree& queryNode, CoverTree& referenceNode);
52 
56  void Traverse(CoverTree& queryNode,
57  std::map<int, std::vector<DualCoverTreeMapEntry<
58  MetricType, RootPointPolicy, StatisticType> > >&
59  referenceMap);
60 
62  size_t NumPrunes() const { return numPrunes; }
64  size_t& NumPrunes() { return numPrunes; }
65 
68  size_t NumVisited() const { return 0; }
69  size_t NumScores() const { return 0; }
70  size_t NumBaseCases() const { return 0; }
71 
72  private:
74  RuleType& rule;
75 
77  size_t numPrunes;
78 
80  void PruneMap(CoverTree& queryNode,
81  std::map<int, std::vector<DualCoverTreeMapEntry<
82  MetricType, RootPointPolicy, StatisticType> > >&
83  referenceMap,
84  std::map<int, std::vector<DualCoverTreeMapEntry<
85  MetricType, RootPointPolicy, StatisticType> > >& childMap);
86 
87  void ReferenceRecursion(CoverTree& queryNode,
88  std::map<int, std::vector<DualCoverTreeMapEntry<
89  MetricType, RootPointPolicy, StatisticType> > >&
90  referenceMap);
91 };
92 
93 }; // namespace tree
94 }; // namespace mlpack
95 
96 // Include implementation.
97 #include "dual_tree_traverser_impl.hpp"
98 
99 #endif
size_t & NumPrunes()
Modify the number of pruned nodes.
Forward declaration of struct to be used for traversal.
size_t numPrunes
The number of pruned nodes.
RuleType & rule
The instantiated rule set for pruning branches.
size_t NumPrunes() const
Get the number of pruned nodes.
A cover tree is a tree specifically designed to speed up nearest-neighbor computation in high-dimensi...
Definition: cover_tree.hpp:103