boost graph: Error with compressed_sparse_row graph and strong_components

Hi,
the following example (taken from csr example in boost docs) fails when
calling strong_components algorithm. The error message is:
/usr/include/boost-1.46.1/boost/graph/strong_components.hpp:59: error: no matching function for call to 'get(int*&, unsigned int&)'
the program works with boost 1.41.0
any help would be much appreciated :-)
#include

On Mon, 9 May 2011, aitor wrote:
Hi,
the following example (taken from csr example in boost docs) fails when calling strong_components algorithm. The error message is:
/usr/include/boost-1.46.1/boost/graph/strong_components.hpp:59: error: no matching function for call to 'get(int*&, unsigned int&)'
the program works with boost 1.41.0
any help would be much appreciated :-)
#include
#include <string> #include <fstream> #include using namespace boost;
int main() { typedef std::pair
E; E the_edges[] = { E(0, 1), E(0, 2), E(0, 3), E(1, 0), E(1, 3), E(1, 5), E(2, 0), E(2, 5), E(3, 1), E(3, 4), E(4, 1), E(5, 0), E(5, 2) }; typedef compressed_sparse_row_graph<directedS> WebGraph; WebGraph g(boost::edges_are_sorted, &the_edges[0], &the_edges[0] + sizeof(the_edges)/sizeof(E), 6);
// strong components
std::vector<int> v(6); int i = boost::strong_components(g, &v[0]);
std::cout << i << "\n";
return 0; }
Try changing the strong_components call to:
boost::iterator_property_map<
std::vector<int>::iterator,
boost::property_map
pm(v.begin(), get(boost::vertex_index, g)); int i = boost::strong_components(g, pm);
-- Jeremiah Willcock

On Mon, May 09, 2011 at 10:26:52AM -0400, Jeremiah Willcock wrote:
Try changing the strong_components call to:
boost::iterator_property_map< std::vector<int>::iterator, boost::property_map
::type pm(v.begin(), get(boost::vertex_index, g)); int i = boost::strong_components(g, pm);
it works nicely. Thank you ! -- aitor
participants (2)
-
aitor
-
Jeremiah Willcock