00001 #ifndef mbl_minimum_spanning_tree_h_ 00002 #define mbl_minimum_spanning_tree_h_ 00003 //: 00004 // \file 00005 // \author Tim Cootes 00006 // \brief Functions to compute minimum spanning trees from distance data 00007 00008 #include <vnl/vnl_matrix.h> 00009 #include <vgl/vgl_point_2d.h> 00010 #include <vgl/vgl_point_3d.h> 00011 #include <vcl_vector.h> 00012 #include <vcl_utility.h> // For vcl_pair 00013 00014 //: Compute the minimum spanning tree given a distance matrix 00015 // \param pairs[0].first is the root node 00016 // Tree defined by pairs. 00017 // \param pairs[i].second is linked to \param pairs[i].first 00018 // We compute the minimum spanning tree of the graph using Prim's algorithm. 00019 void mbl_minimum_spanning_tree(const vnl_matrix<double>& D, 00020 vcl_vector<vcl_pair<int,int> >& pairs); 00021 00022 //: Compute the minimum spanning tree of given points 00023 // \param pairs[0].first is the root node 00024 // Tree defined by pairs. 00025 // \param pairs[i].second is linked to \param pairs[i].first 00026 // We compute the minimum spanning tree of the graph using Prim's algorithm. 00027 void mbl_minimum_spanning_tree(const vcl_vector<vgl_point_2d<double> >& pts, 00028 vcl_vector<vcl_pair<int,int> >& pairs); 00029 00030 //: Compute the minimum spanning tree of given points 00031 // \param pairs[0].first is the root node 00032 // Tree defined by pairs. 00033 // \param pairs[i].second is linked to \param pairs[i].first 00034 // We compute the minimum spanning tree of the graph using Prim's algorithm. 00035 void mbl_minimum_spanning_tree(const vcl_vector<vgl_point_3d<double> >& pts, 00036 vcl_vector<vcl_pair<int,int> >& pairs); 00037 00038 #endif // mbl_minimum_spanning_tree_h_