vbl_graph_partition.h
Go to the documentation of this file.
1 // This is core/vbl/vbl_graph_partition.h
2 #ifndef vbl_graph_partition_h_
3 #define vbl_graph_partition_h_
4 //:
5 // \file
6 // \brief Partitions a graph into disjoint connected components
7 // \author J. Mundy
8 // \date February 14, 2013
9 // \verbatim
10 // \endverbatim
11 //-----------------------------------------------------------------------------
12 // Adapted from the paper and code by Pedro Felzenszwalb
13 // International Journal of Computer Vision, Vol. 59, No. 2, September 2004
14 // The graph is represented by a set of integer vertex ids and edges that
15 // are a pair of vertices. Each edge has an associated weight. Edges
16 // are sorted according to weight and then connected components are
17 // merged if the difference in internal component weights are greater
18 // than the smallest weight edge between a pair of adjacent components.
19 // The result is a set of isolated sub-graphs of the original graph.
20 #include <vector>
21 #ifdef _MSC_VER
22 # include <vcl_msvc_warnings.h>
23 #endif
24 #include <vbl/vbl_disjoint_sets.h>
25 #include <vbl/vbl_edge.h>
26 #include <vil/vil_image_view.h>
27 
28 //:
29 // \p t is a constant that determines the threshold on edge weight
30 // to form disconnected sets
31 void vbl_graph_partition(vbl_disjoint_sets& ds, std::vector<vbl_edge>& edges, float t);
32 
33 
34 #endif // vbl_graph_partition_h_
implements a disjoint set (union, find)
void vbl_graph_partition(vbl_disjoint_sets &ds, std::vector< vbl_edge > &edges, float t)
t is a constant that determines the threshold on edge weight to form disconnected sets
A class representing a graph edge with integer vertex ids.