35 #ifndef __MLPACK_METHODS_EMST_DTB_HPP
36 #define __MLPACK_METHODS_EMST_DTB_HPP
97 typename TreeType::Mat&
data;
147 const bool naive =
false,
148 const size_t leafSize = 1,
149 const MetricType
metric = MetricType());
169 const MetricType
metric = MetricType());
191 void AddEdge(
const size_t e1,
const size_t e2,
const double distance);
219 #include "dtb_impl.hpp"
221 #endif // __MLPACK_METHODS_EMST_DTB_HPP
void AddEdge(const size_t e1, const size_t e2, const double distance)
Adds a single edge to the edge list.
A Union-Find data structure.
An edge pair is simply two indices and a distance.
TreeType * tree
Pointer to the root of the tree.
arma::Col< size_t > neighborsInComponent
List of edge nodes.
void ComputeMST(arma::mat &results)
Iteratively find the nearest neighbor of each component until the MST is complete.
LMetric< 2, true > EuclideanDistance
void AddAllEdges()
Adds all the edges found in one iteration to the list of neighbors.
arma::vec neighborsDistances
List of edge distances.
bool naive
Indicates whether or not O(n^2) naive mode will be used.
UnionFind connections
Connections.
DualTreeBoruvka(const typename TreeType::Mat &dataset, const bool naive=false, const size_t leafSize=1, const MetricType metric=MetricType())
Create the tree from the given dataset.
struct mlpack::emst::DualTreeBoruvka::SortEdgesHelper SortFun
A binary space partitioning tree, such as a KD-tree or a ball tree.
~DualTreeBoruvka()
Delete the tree, if it was created inside the object.
void CleanupHelper(TreeType *tree)
This function resets the values in the nodes of the tree nearest neighbor distance, and checks for fully connected nodes.
void Cleanup()
The values stored in the tree must be reset on each iteration.
void EmitResults(arma::mat &results)
Unpermute the edge list and output it to results.
bool ownTree
Indicates whether or not we "own" the tree.
MetricType metric
The instantiated metric.
double totalDist
Total distance of the tree.
bool operator()(const EdgePair &pairA, const EdgePair &pairB)
arma::Col< size_t > neighborsOutComponent
List of edge nodes.
std::vector< EdgePair > edges
Edges.
TreeType::Mat dataCopy
Copy of the data (if necessary).
A statistic for use with MLPACK trees, which stores the upper bound on distance to nearest neighbors ...
For sorting the edge list after the computation.
TreeType::Mat & data
Reference to the data (this is what should be used for accessing data).
Performs the MST calculation using the Dual-Tree Boruvka algorithm, using any type of tree...
double Distance() const
Get the distance.
std::vector< size_t > oldFromNew
Permutations of points during tree building.