27 #ifndef __MLPACK_METHODS_EMST_DTB_HPP
28 #define __MLPACK_METHODS_EMST_DTB_HPP
89 const typename TreeType::Mat&
data;
139 const bool naive =
false,
140 const MetricType metric = MetricType());
160 const typename TreeType::Mat& dataset,
161 const MetricType metric = MetricType());
188 void AddEdge(
const size_t e1,
const size_t e2,
const double distance);
216 #include "dtb_impl.hpp"
218 #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.
Linear algebra utility functions, generally performed on matrices or vectors.
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.
DualTreeBoruvka(const typename TreeType::Mat &dataset, const bool naive=false, const MetricType metric=MetricType())
Create the tree from the given dataset.
bool naive
Indicates whether or not O(n^2) naive mode will be used.
UnionFind connections
Connections.
std::string ToString() const
Returns a string representation of this object.
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.
const 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.