im kind of new with boost library (windows 7\ visual studio 2010). I followed this example code:
#include <boost/config.hpp>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>
using namespace std;
int main(int , char* [])
{
using namespace boost;
{
typedef adjacency_list <vecS, vecS, undirectedS> Graph;
Graph G;
add_edge(0, 1, G);
add_edge(1, 4, G);
add_edge(4, 0, G);
add_edge(2, 5, G);
std::vector<int> component(num_vertices(G));
int num = connected_components(G, &component[0]);
std::vector<int>::size_type i;
cout << "Total number of components: " << num << endl;
for (i = 0; i != component.size(); ++i)
cout << "Vertex " << i <<" is in component " << component[i] << endl;
cout << endl;
}
return 0;
}
the code builds the graph and prints which vertex belongs to which component by the for loop.
is there an example of function that gets a graph and returns\ stores which vertex belongs to which component- in organized way(some kind of data structure)? and not with for loop?
I tried to search here, hope I didn't miss it.
thanks.
EDIT: the goal is to take measurements on every component (such as number of nodes, diameter, number of neighbors for every node in one component..)