any suggestions?
If I construct a vector of std::pair explicitly I can
get this to compile. But it's hardly an elegant way to copy a graph...
// begin code
#include <iostream>
#include <sstream>
#include
#include
int main(int argc, char** argv) {
typedef boost::adjacency_list < boost::listS, // outedgelist
boost::vecS, // vertexlist
boost::directedS> // directed
Dgraph;
typedef boost::graph_traits<Dgraph>::edge_iterator EdgeItr;
typedef boost::graph_traits<Dgraph>::vertex_descriptor Vertex;
Dgraph g(5);
add_edge (0,1,g);
add_edge (2,3,g);
add_edge (4,5,g);
print_graph (g, boost::get(boost::vertex_index, g) );
EdgeItr i1 = (boost::edges(g)).first;
EdgeItr i2 = (boost::edges(g)).second;
std::vector< std::pair > edgevector;
for (EdgeItr e = i1; e!=i2 ; e++ ) {
std::pair p = std::make_pair( source(*e,g),
target(*e,g) );
edgevector.push_back(p);
}
Dgraph g2 = Dgraph( edgevector.begin(), edgevector.end(),
num_vertices(g), num_edges(g));
print_graph (g2, boost::get(boost::vertex_index, g2));
return 0;
}
// end code