|
Boost Users : |
Subject: [Boost-users] BGL: how to count and get the connected components in the spanning_tree
From: arm2arm (arm2arm_at_[hidden])
Date: 2009-06-05 06:50:59
Hello,
I am trying to get connected components in the MST.
I have some undirected graph:
----------- BEGIN SNIP ------------------------
typedef adjacency_list < vecS, vecS, undirectedS,
no_property, property < edge_weight_t, MyFloat > > Graph;
typedef property_map<Graph, edge_weight_t>::type EdgeWeightMap;
Graph graphFOF;
... Fill the graph..
//Get the MST
property_map < Graph, edge_weight_t >::type weight = get(edge_weight,
graphFOF);
std::vector < Edge > spanning_tree;
std::cout << "Building MST:." ;
kruskal_minimum_spanning_tree(graphFOF, std::back_inserter(spanning_tree));
std::cout << " .. done " << std::endl;
//
// Here is problem: How to use MST edges for filtering the graphFOF??
positive_edge_weight<EdgeWeightMap> filter(meanW, get(edge_weight,
graphFOF));
filtered_graph<Graph, positive_edge_weight<EdgeWeightMap> >
fg(graphFOF, filter);
std::vector<int> component(num_vertices(fg));
int num = connected_components(fg, &component[0]);
------------END SNIP---------------------------
How to count and get the connected components in the spanning_tree?
Thank you beforehand.
Arman.
-- View this message in context: http://www.nabble.com/BGL%3A-how-to-count-and-get-the-connected-components-in-the-spanning_tree-tp23886100p23886100.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net