@@ -220,57 +220,40 @@ unsigned int id_generator::get_next_id() {
220
220
return current_id ++;
221
221
}
222
222
223
- void scan::print_graph (Graph& g) {
223
+ void scan::print_graph (std::ostream& output, Graph& g) {
224
224
225
- //
226
- // dynamic_properties dp;
227
- //
228
- //
229
- // Graph::vertex_iterator current, end;
230
- //
231
- // tie (current, end) = vertices(g);
232
- // for (; current != end; current++) {
233
- // unsigned int index = get(vertex_index, g, *current);
234
- // unsigned int cluster_id = get(vertex_cluster_id, g, *current);
235
- // node_status_t status = get(vertex_status, g, *current);
236
- // std::string name;
237
- // switch (status) {
238
- // case node_status_member:
239
- // name = std::string("member");
240
- // break;
241
- // case node_status_hub:
242
- // name = std::string("hub");
243
- // break;
244
- // case node_status_outlier:
245
- // name = std::string("outlier");
246
- // break;
247
- // default:
248
- // name = std::string("?");
249
- // }
250
- //
251
- // std::string format = std::string("%d (%d) %s");
252
- // put(vertex_name, g, *current, name);
253
- // }
254
- //
255
- // dp.property("similarity", boost::get(edge_similarity, g));
256
- // dp.property("neighbours", boost::get(vertex_neighbour_count, g));
257
- // dp.property("node_id", boost::get(vertex_index, g));
258
- // dp.property("is_core", boost::get(vertex_is_core, g));
259
- // dp.property("cluster_id", boost::get(vertex_cluster_id, g));
260
- // dp.property("status", boost::get(vertex_name, g));
261
- //
262
- // write_graphviz_dp(std::cout, g, dp);
225
+ dynamic_properties dp;
263
226
264
- property_map<Graph, vertex_cluster_id_t >::type vertex_cluster_id_map = get (vertex_cluster_id, g);
265
- property_map<Graph, vertex_index_t >::type vertex_id_map = get (vertex_index, g);
266
- property_map<Graph, edge_similarity_t >::type edge_similarity_map = get (edge_similarity, g);
227
+ Graph::vertex_iterator current, end;
267
228
268
- dynamic_properties dp;
229
+ tie (current, end) = boost::vertices (g);
230
+ for (; current != end; current++) {
231
+ node_status_t status = boost::get (vertex_status, g, *current);
232
+ std::string name;
233
+ switch (status) {
234
+ case node_status_member:
235
+ name = std::string (" member" );
236
+ break ;
237
+ case node_status_hub:
238
+ name = std::string (" hub" );
239
+ break ;
240
+ case node_status_outlier:
241
+ name = std::string (" outlier" );
242
+ break ;
243
+ default :
244
+ name = std::string (" ?" );
245
+ }
246
+
247
+ put (vertex_name, g, *current, name);
248
+ }
269
249
270
- dp.property (" cluster_id" , vertex_cluster_id_map);
271
- dp.property (" id" , vertex_id_map);
272
- dp.property (" similarity" , edge_similarity_map);
250
+ dp.property (" cluster_id" , get (vertex_cluster_id, g));
251
+ dp.property (" id" , get (vertex_index, g));
252
+ dp.property (" similarity" , get (edge_similarity, g));
253
+ dp.property (" neighbours_count" , get (vertex_neighbour_count, g));
254
+ dp.property (" is_core" , get (vertex_is_core, g));
255
+ dp.property (" similarity_is_high" , get (edge_similarity_is_high, g));
256
+ dp.property (" status" , get (vertex_name, g));
273
257
274
- write_graphviz_dp (std::cout , g, dp, " id" );
258
+ write_graphviz_dp (output , g, dp, " id" );
275
259
}
276
-
0 commit comments