35 #ifndef __MLPACK_METHODS_EMST_DTB_HPP
36 #define __MLPACK_METHODS_EMST_DTB_HPP
86 template<
typename TreeType>
209 const bool naive =
false,
210 const size_t leafSize = 1,
211 const MetricType
metric = MetricType());
231 const MetricType
metric = MetricType());
253 void AddEdge(
const size_t e1,
const size_t e2,
const double distance);
281 #include "dtb_impl.hpp"
283 #endif // __MLPACK_METHODS_EMST_DTB_HPP
double minNeighborDistance
Lower bound on the distance to the nearest neighbor of any point in this node.
void AddEdge(const size_t e1, const size_t e2, const double distance)
Adds a single edge to the edge list.
double MaxNeighborDistance() const
Get the maximum neighbor distance.
A Union-Find data structure.
double & Bound()
Modify the total bound for pruning.
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.
int componentMembership
The index of the component that all points in this node belong to.
arma::vec neighborsDistances
List of edge distances.
bool naive
Indicates whether or not O(n^2) naive mode will be used.
double & MaxNeighborDistance()
Modify the maximum neighbor distance.
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.
DTBStat()
A generic initializer.
int ComponentMembership() const
Get the component membership of this node.
double maxNeighborDistance
Upper bound on the distance to the nearest neighbor of any point in this node.
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.
double MinNeighborDistance() const
Get the minimum neighbor distance.
int & ComponentMembership()
Modify the component membership of this node.
double bound
Total bound for pruning.
std::vector< EdgePair > edges
Edges.
TreeType::Mat dataCopy
Copy of the data (if necessary).
double & MinNeighborDistance()
Modify the minimum neighbor distance.
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.
double Bound() const
Get the total bound for pruning.