Hi all,
Could somebody tell me how to add a bundled edge property for subgraph, please?
The code, based on [1], is as follows.
// code starts
#include
#include
#include
#include
using namespace std;
using namespace boost;
struct VertexProperty {
int intValue;
};
struct EdgeProperty {
std::size_t biconnected_component;
int intValue;
};
typedef adjacency_list > PlainGraph;
typedef subgraph<PlainGraph> Graph;
int main(int argc, char* argv[])
{
PlainGraph g1;
Graph g(2);
VertexProperty v0;
v0.intValue = 1;
VertexProperty v1;
v0.intValue = 1;
EdgeProperty e;
e.biconnected_component = 0;
e.intValue = 0;
add_edge(0, 1, g);
put(get(vertex_bundle,g), 0, v0); // OK
put(get(vertex_bundle,g), 1, v1); // OK
put(get(edge_bundle,g), 0, e); // error here
return 0;
}
// code ends
The error is as follows:
// error starts
1>D:\API\boost_1_53_0\boost/property_map/property_map.hpp(361): error
C2679: binary '[' : no operator found which takes a right-hand operand
of type 'int' (or there is no acceptable conversion)
1> D:\API\boost_1_53_0\boost/graph/subgraph.hpp(797): could
be 'EdgeProperty
&boost::subgraph_global_property_map::operator
[](boost::detail::edge_desc_impl) const'
1> with
1> [
1> GraphPtr=boost::subgraph<PlainGraph> ,
1>
PropertyMap=boost::adj_list_edge_property_mapboost::edge_index_t,int,EdgeProperty,boost::edge_bundle_t>,
1> Tag=boost::edge_bundle_t,
1> Directed=boost::undirected_tag,
1> Vertex=unsigned __int64
1> ]
1> while trying to match the argument list '(const
boost::subgraph_global_property_map, int)'
1> with
1> [
1> GraphPtr=boost::subgraph<PlainGraph> ,
1>
PropertyMap=boost::adj_list_edge_property_mapboost::edge_index_t,int,EdgeProperty,boost::edge_bundle_t>,
1> Tag=boost::edge_bundle_t
1> ]
1> main.cpp(74) : see reference to function template
instantiation 'void
boost::put,EdgeProperty&,int,EdgeProperty>(const
boost::put_get_helper &,K,const V &)'
being compiled
1> with
1> [
1> GraphPtr=boost::subgraph<PlainGraph> ,
1>
PropertyMap=boost::adj_list_edge_property_mapboost::edge_index_t,int,EdgeProperty,boost::edge_bundle_t>,
1> Tag=boost::edge_bundle_t,
1> Reference=EdgeProperty &,
1>
LvaluePropertyMap=boost::subgraph_global_property_mapboost::edge_index_t,int,EdgeProperty,boost::edge_bundle_t>,boost::edge_bundle_t>,
1> K=int,
1> V=EdgeProperty
1> ]
1>
// error ends
I found a few other threads [2, 3] about this, but their solutions
don't solve the problem. BTW I use Visual Studio 2010 on Windows 7
64-bit. The Boost version is 1.53.0.
Thank you!
Best regards,
Nicholas Mario Wardhana
References:
[1] http://boost.2283326.n4.nabble.com/BGL-Bundled-Properties-in-subgraphs-td256...
[2] http://stackoverflow.com/questions/7608031/boost-subgraph-and-bundled-proper...
[3] https://groups.google.com/forum/?fromgroups=#!topic/boost-list/5EIkKybaUTY