Mercurial Hosting > traffic-intelligence
comparison c/Motion.cpp @ 189:1116f0a1ff31
work on connected components (does not compile)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 02 Dec 2011 19:11:53 -0500 |
parents | 1435965d8181 |
children | 36968a63efe1 |
comparison
equal
deleted
inserted
replaced
188:1435965d8181 | 189:1116f0a1ff31 |
---|---|
157 if (lastInstant-firstInstant > static_cast<int>(minFeatureTime)) { // equivalent to lastInstant-firstInstant+1 >= minFeatureTime | 157 if (lastInstant-firstInstant > static_cast<int>(minFeatureTime)) { // equivalent to lastInstant-firstInstant+1 >= minFeatureTime |
158 if (ft->minMaxSimilarity(*ft2, firstInstant, lastInstant, connectionDistance, segmentationDistance)) { | 158 if (ft->minMaxSimilarity(*ft2, firstInstant, lastInstant, connectionDistance, segmentationDistance)) { |
159 UndirectedGraph::edge_descriptor e; | 159 UndirectedGraph::edge_descriptor e; |
160 bool unused; | 160 bool unused; |
161 tie(e, unused) = add_edge(newVertex, *vi, graph); | 161 tie(e, unused) = add_edge(newVertex, *vi, graph); |
162 // no need to add measures to graph[e] | 162 // no need to add measures to graph[e] (edge properties) |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 void FeatureGraph::connectedComponents(const int& lastInstant) { | 168 void FeatureGraph::connectedComponents(const int& lastInstant) { |
169 vector<int> component(num_vertices(graph)); | 169 typedef boost::graph_traits<UndirectedGraph>::vertices_size_type vertices_size_type; |
170 // int num = connected_components(graph, &component[0]); | 170 vector<vertices_size_type> components(num_vertices(graph)); |
171 // todo change the type of the component map http://www.boost.org/doc/libs/1_48_0/libs/graph/doc/connected_components.html | 171 // int num = connected_components(graph, &components[0]); |
172 | 172 // // todo change the type of the component map http://www.boost.org/doc/libs/1_48_0/libs/graph/doc/connected_components.html |
173 // cout << "Total number of components: " << num << endl; | 173 // cout << "Total number of components: " << num << endl; |
174 | 174 |
175 for (unsigned int i = 0; i < component.size(); ++i) | 175 // for (unsigned int i = 0; i < components.size(); ++i) |
176 cout << "Vertex " << i <<" is in component " << component[i] << endl; | 176 // cout << "Vertex " << i <<" is in component " << components[i] << endl; |
177 cout << endl; | 177 // cout << endl; |
178 } | 178 } |
179 | 179 |
180 string FeatureGraph::informationString(void) { | 180 string FeatureGraph::informationString(void) { |
181 stringstream ss; | 181 stringstream ss; |
182 ss << num_vertices(graph) << " vertices, " << num_edges(graph) << " edges"; | 182 ss << num_vertices(graph) << " vertices, " << num_edges(graph) << " edges"; |