forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomponents.h
More file actions
133 lines (111 loc) · 3.16 KB
/
Copy pathcomponents.h
File metadata and controls
133 lines (111 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* This software is distributed under the GNU Lesser General Public License */
//==========================================================================
//
// components.h
//
//==========================================================================
// $Id: components.h,v 1.5 2003/04/03 11:44:42 raitner Exp $
#ifndef GTL_COMPONENTS_H
#define GTL_COMPONENTS_H
#include <GTL/GTL.h>
#include <GTL/dfs.h>
#include <list>
__GTL_BEGIN_NAMESPACE
/**
* @brief Connected components algorithm
*/
class GTL_EXTERN components : public dfs
{
public:
/**
* @brief Creates connected components algorithm object.
*
* @sa dfs::dfs
*/
components ();
/**
* @brief Destroys connected components algorithm object.
*
* @sa dfs::~dfs
*/
virtual ~components () {}
/**
* @brief Checks whether the connected components algorithm can be applied
*
* Necessary preconditions:
* - G is undirected.
* - scanning of whole graph is enabled.
* - DFS may be applied
*
* @param G graph.
* @return algorithm::GTL_OK if connected components can be computed for G.
* @sa dfs::scan_whole_graph
*/
virtual int check (graph& G);
virtual void reset ();
/**
* @internal
*/
typedef std::list<std::pair<nodes_t, edges_t> >::iterator component_iterator;
/**
* @brief Start iteration over all components (if enabled during
* last call to run).
* Components are represented as a pair consisting of
* a list of nodes and a list of edges,
* i.e. if @c it is of type @c component_iterator
* then @c *it is of type
* @c pair<list<node>,list<edge> >.
*
* @return iterator to first component
*/
component_iterator components_begin ()
{ return comp.begin(); }
/**
* @brief End of iteration over all components.
*
* @return end of iteration over biconnected components
* @sa biconnectivity::store_components
*/
component_iterator components_end ()
{ return comp.end(); }
/**
* @brief Number of components detected during the last run.
*
* @return number of components.
*/
int number_of_components () const
{return num_of_components; }
//-----------------------------------------------------------------------
// Handler used to extend dfs to biconnectivity
//-----------------------------------------------------------------------
/**
* @internal
*/
virtual void before_recursive_call_handler (graph&, edge&, node&);
/**
* @internal
*/
virtual void old_adj_node_handler (graph&, edge&, node&);
/**
* @internal
*/
virtual void new_start_handler (graph&, node&);
protected:
/**
* @internal
*/
int num_of_components;
/**
* @internal
*/
std::list<std::pair<nodes_t, edges_t> > comp;
/**
* @internal
*/
component_iterator li;
};
__GTL_END_NAMESPACE
#endif // GTL_BICONNECTIVITY_H
//--------------------------------------------------------------------------
// end of file
//--------------------------------------------------------------------------