27 #ifndef __MLPACK_METHODS_EMST_DTB_HPP 28 #define __MLPACK_METHODS_EMST_DTB_HPP 80 typename MatType = arma::mat,
81 template<
typename TreeMetricType,
82 typename TreeStatType,
89 typedef TreeType<MetricType, DTBStat, MatType>
Tree;
142 const bool naive =
false,
143 const MetricType metric = MetricType());
163 const MetricType metric = MetricType());
185 void AddEdge(
const size_t e1,
const size_t e2,
const double distance);
213 #include "dtb_impl.hpp" 215 #endif // __MLPACK_METHODS_EMST_DTB_HPP bool naive
Indicates whether or not O(n^2) naive mode will be used.
A Union-Find data structure.
An edge pair is simply two indices and a distance.
const MatType & data
Reference to the data (this is what should be used for accessing data).
Linear algebra utility functions, generally performed on matrices or vectors.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
std::vector< EdgePair > edges
Edges.
struct mlpack::emst::DualTreeBoruvka::SortEdgesHelper SortFun
void Cleanup()
The values stored in the tree must be reset on each iteration.
MetricType metric
The instantiated metric.
bool ownTree
Indicates whether or not we "own" the tree.
A binary space partitioning tree, such as a KD-tree or a ball tree.
double Distance() const
Get the distance.
void ComputeMST(arma::mat &results)
Iteratively find the nearest neighbor of each component until the MST is complete.
arma::Col< size_t > neighborsOutComponent
List of edge nodes.
bool operator()(const EdgePair &pairA, const EdgePair &pairB)
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
DualTreeBoruvka(const MatType &dataset, const bool naive=false, const MetricType metric=MetricType())
Create the tree from the given dataset.
void EmitResults(arma::mat &results)
Unpermute the edge list and output it to results.
double totalDist
Total distance of the tree.
~DualTreeBoruvka()
Delete the tree, if it was created inside the object.
std::vector< size_t > oldFromNew
Permutations of points during tree building.
TreeType< MetricType, DTBStat, MatType > Tree
Convenience typedef.
For sorting the edge list after the computation.
arma::vec neighborsDistances
List of edge distances.
void CleanupHelper(Tree *tree)
This function resets the values in the nodes of the tree nearest neighbor distance, and checks for fully connected nodes.
UnionFind connections
Connections.
arma::Col< size_t > neighborsInComponent
List of edge nodes.
Performs the MST calculation using the Dual-Tree Boruvka algorithm, using any type of tree...
Tree * tree
Pointer to the root of the tree.
void AddEdge(const size_t e1, const size_t e2, const double distance)
Adds a single edge to the edge list.
void AddAllEdges()
Adds all the edges found in one iteration to the list of neighbors.