latest version v1.9 - last update 10 Apr 2010 |
This class computes minimum spanning trees. More...
#include <ltiMinimumSpanningTree.h>
Classes | |
class | parameters |
the parameters for the class minimumSpanningTree More... | |
Public Types | |
typedef Distantor::distance_type | distance_type |
Public Member Functions | |
minimumSpanningTree () | |
minimumSpanningTree (const parameters &par) | |
minimumSpanningTree (const minimumSpanningTree &other) | |
virtual | ~minimumSpanningTree () |
virtual const char * | getTypeName () const |
virtual bool | apply (const std::vector< K > &src, const std::vector< V > &datas, weightedGraph< K, V, distance_type > &graph) const |
virtual bool | apply (const weightedGraph< K, V, distance_type > &src, weightedGraph< K, V, distance_type > &dest) const |
virtual bool | apply (weightedGraph< K, V, distance_type > &srcDest) const |
minimumSpanningTree & | copy (const minimumSpanningTree &other) |
minimumSpanningTree & | operator= (const minimumSpanningTree &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
Protected Types | |
typedef K::value_type | key_value_type |
typedef weightedGraph< K, V, distance_type >::node | node_type |
Protected Member Functions | |
bool | buildGraph (const std::vector< K > &src, const std::vector< V > &datas, weightedGraph< K, V, distance_type > &graph) const |
bool | buildCompleteGraph (const std::vector< K > &src, const std::vector< V > &datas, weightedGraph< K, V, distance_type > &graph) const |
Protected Attributes | |
Distantor | distantor |
This class computes minimum spanning trees.
There are two ways two compute a minimum spanning trees. Either reduce a given weighted graph to its minimum spanning tree or compute the minimum spanning tree direct from a given data set. If you only want to reduce a weighted graph, just use the apply methods. If you want to compute the tree from a given data set (keys and values), there a three possibilities.
A minimum spanning tree has the following template types:
The Distantor must implement the operator() which takes two arguments of type K and calculates their distance. It must define a type Distantor::distance_type which is also the return type of the operator. See lti::l2SquareDistantor for an example.
typedef Distantor::distance_type lti::minimumSpanningTree< K, V, Distantor >::distance_type |
return type of a call to the distantor, Distantor::distance_type
Reimplemented in lti::minimumSpanningTreeOfKeytype< K, V, Distantor >, and lti::minimumSpanningTreeOfKeyValuetype< K, V, Distantor >.
typedef K::value_type lti::minimumSpanningTree< K, V, Distantor >::key_value_type [protected] |
The value type of the key type.
Reimplemented in lti::minimumSpanningTreeOfKeytype< K, V, Distantor >, and lti::minimumSpanningTreeOfKeyValuetype< K, V, Distantor >.
typedef weightedGraph<K,V,distance_type>::node lti::minimumSpanningTree< K, V, Distantor >::node_type [protected] |
the type of a node of the weightedGraph used in the MST
lti::minimumSpanningTree< K, V, Distantor >::minimumSpanningTree | ( | ) |
default constructor
lti::minimumSpanningTree< K, V, Distantor >::minimumSpanningTree | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::minimumSpanningTree< K, V, Distantor >::minimumSpanningTree | ( | const minimumSpanningTree< K, V, Distantor > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::minimumSpanningTree< K, V, Distantor >::~minimumSpanningTree | ( | ) | [virtual] |
destructor
virtual bool lti::minimumSpanningTree< K, V, Distantor >::apply | ( | weightedGraph< K, V, distance_type > & | srcDest | ) | const [virtual] |
virtual bool lti::minimumSpanningTree< K, V, Distantor >::apply | ( | const weightedGraph< K, V, distance_type > & | src, | |
weightedGraph< K, V, distance_type > & | dest | |||
) | const [virtual] |
virtual bool lti::minimumSpanningTree< K, V, Distantor >::apply | ( | const std::vector< K > & | src, | |
const std::vector< V > & | datas, | |||
weightedGraph< K, V, distance_type > & | graph | |||
) | const [virtual] |
bool lti::minimumSpanningTree< K, V, Distantor >::buildCompleteGraph | ( | const std::vector< K > & | src, | |
const std::vector< V > & | datas, | |||
weightedGraph< K, V, distance_type > & | graph | |||
) | const [protected] |
Builds a complete graph of the input data.
bool lti::minimumSpanningTree< K, V, Distantor >::buildGraph | ( | const std::vector< K > & | src, | |
const std::vector< V > & | datas, | |||
weightedGraph< K, V, distance_type > & | graph | |||
) | const [protected] |
Builds up a graph that can be used for computing the minimum spanning tree.
This graph is not complete. But in most cases the edges that this graph contains, are all edges that are needed for finding the correct minimum spanning tree. The advantage of this version is that searching for the minimum spanning tree will be much faster. For this tree all points are connected with their neighbors. The number of neighbors it is connected to can be set by the parameter nbNeighbors. After that it is guaranteed that the graph is a connected graph.
virtual functor* lti::minimumSpanningTree< K, V, Distantor >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::functor.
Reimplemented in lti::minimumSpanningTreeOfKeytype< K, V, Distantor >, and lti::minimumSpanningTreeOfKeyValuetype< K, V, Distantor >.
minimumSpanningTree& lti::minimumSpanningTree< K, V, Distantor >::copy | ( | const minimumSpanningTree< K, V, Distantor > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
Reimplemented in lti::minimumSpanningTreeOfKeytype< K, V, Distantor >, and lti::minimumSpanningTreeOfKeyValuetype< K, V, Distantor >.
const parameters& lti::minimumSpanningTree< K, V, Distantor >::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::functor.
Reimplemented in lti::minimumSpanningTreeOfKeytype< K, V, Distantor >, and lti::minimumSpanningTreeOfKeyValuetype< K, V, Distantor >.
virtual const char* lti::minimumSpanningTree< K, V, Distantor >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("minimumSpanningTree")
Reimplemented from lti::functor.
Reimplemented in lti::minimumSpanningTreeOfKeytype< K, V, Distantor >, and lti::minimumSpanningTreeOfKeyValuetype< K, V, Distantor >.
minimumSpanningTree& lti::minimumSpanningTree< K, V, Distantor >::operator= | ( | const minimumSpanningTree< K, V, Distantor > & | other | ) |
alias for copy member
other | the functor to be copied |
Reimplemented from lti::functor.
Reimplemented in lti::minimumSpanningTreeOfKeytype< K, V, Distantor >, and lti::minimumSpanningTreeOfKeyValuetype< K, V, Distantor >.
Distantor lti::minimumSpanningTree< K, V, Distantor >::distantor [protected] |
Distantor.