Boost logo

Boost :

Subject: [boost] [BGL] reverse_graph
From: Fabien Castan (fabien.castan_at_[hidden])
Date: 2011-12-10 19:22:55


Hi,
I have some troubles using boost::transpose_graph since boost 1.48.
See the sample code.
Fabien

#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/copy.hpp>
#include <boost/graph/transpose_graph.hpp>

template<class GraphIn, class GraphOut>
class Copier
{
public:
 Copier( const GraphIn& gIn, GraphOut& gOut )
: _gIn(gIn)
, _gOut(gOut)
 {}
    template<class VIn, class VOut>
    void operator()(const VIn& vIn, VOut& vOut)
{
 _gOut[vOut] = _gIn[vIn];
}
private:
const GraphIn& _gIn;
 GraphOut& _gOut;
};

struct CustomVertex
{
};
struct CustomEdge
{
};

typedef boost::adjacency_list<
boost::setS, // disallow parallel edges (OutEdgeList)
boost::vecS, // vertex container (VertexList)
 boost::bidirectionalS, // directed graph
CustomVertex,
CustomEdge,
 boost::no_property, // no GraphProperty
boost::listS // EdgeList
> GraphContainer;

int main( int argc, char** argv )
{
const GraphContainer a;
GraphContainer b;
 Copier< GraphContainer, GraphContainer > copier( a, b );
 // still works as before
boost::copy_graph( a, b, boost::vertex_copy(copier).edge_copy(copier) );
 // works with boost 1.47, but doesn't compile with boost 1.48
boost::transpose_graph( a, b, boost::vertex_copy(copier).edge_copy(copier)
); //<<<<<
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk