25#ifndef MLPACK_METHODS_EMST_DTB_HPP
26#define MLPACK_METHODS_EMST_DTB_HPP
78 typename MatType = arma::mat,
79 template<
typename TreeMetricType,
80 typename TreeStatType,
87 typedef TreeType<MetricType, DTBStat, MatType>
Tree;
91 std::vector<size_t> oldFromNew;
103 std::vector<EdgePair> edges;
109 arma::Col<size_t> neighborsInComponent;
111 arma::Col<size_t> neighborsOutComponent;
113 arma::vec neighborsDistances;
122 struct SortEdgesHelper
140 const bool naive =
false,
141 const MetricType metric = MetricType());
160 const MetricType metric = MetricType());
182 void AddEdge(
const size_t e1,
const size_t e2,
const double distance);
192 void EmitResults(arma::mat& results);
198 void CleanupHelper(
Tree* tree);
209#include "dtb_impl.hpp"
Performs the MST calculation using the Dual-Tree Boruvka algorithm, using any type of tree.
void ComputeMST(arma::mat &results)
Iteratively find the nearest neighbor of each component until the MST is complete.
DualTreeBoruvka(Tree *tree, const MetricType metric=MetricType())
Create the DualTreeBoruvka object with an already initialized tree.
DualTreeBoruvka(const MatType &dataset, const bool naive=false, const MetricType metric=MetricType())
Create the tree from the given dataset.
TreeType< MetricType, DTBStat, MatType > Tree
Convenience typedef.
~DualTreeBoruvka()
Delete the tree, if it was created inside the object.
An edge pair is simply two indices and a distance.
double Distance() const
Get the distance.
A Union-Find data structure.
A binary space partitioning tree, such as a KD-tree or a ball tree.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.