Boost logo

Boost :

Subject: Re: [boost] [BGL] reverse_graph
From: Fabien Castan (fabien.castan_at_[hidden])
Date: 2011-12-11 08:10:34


>
> Please see if the latest trunk fixes this issue (I put in a few bug fixes
> just now); your code now compiles for me.
>
Yes, it fixes this problem but creates another one.
See the updated 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
// but works with the trunk version
boost::transpose_graph( a, b, boost::vertex_copy(copier).edge_copy(copier)
);
 // works with boost 1.47 and 1.48, but doesn't work with the trunk version
boost::transpose_graph( a, b ); //<<<<<
}


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