Boost logo

Boost Users :

Subject: [Boost-users] Getting undirected graph from directed graph discarding properties
From: Philipp Klaus Krause (pkk_at_[hidden])
Date: 2012-10-10 04:24:49


I have a directed graph that has some properties, and I want the
underlying undirected graph, but don't need the properties there.
Assuming G is the directed graph with properties, and G_sym is the
undirected without them, up until boost 1.50 I used:

boost::copy_graph(G, G_sym);

But as of boost 1.51 and 1.52 this gives an error due to the properties.
Is there an easy way to do what I want to do in boost, and if yes, how?

Philipp

g++ -pipe -ggdb -g -O2 -Wall -Wno-parentheses -I /tmp/boost_1_52_0_beta1
-I /tmp/boost_1_52_0_beta1 -I. -I. -I././support/util -I. -I
/tmp/boost_1_52_0_beta1 -I. -I.. -I./../support/util -I. -I. -c -o
SDCClospre.o SDCClospre.cc
In file included from SDCClospre.hpp:26:0,
                 from SDCClospre.cc:24:
SDCCtree_dec.hpp: In instantiation of ‘void
tree_decomposition_from_elimination_ordering(T_t&, const
std::list<unsigned int>&, const G_t&) [with T_t =
boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
tree_dec_lospre_node>; G_t = boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>]’:
SDCCtree_dec.hpp:274:3: required from ‘void
thorup_tree_decomposition(T_t&, const G_t&) [with T_t =
boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
tree_dec_lospre_node>; G_t = boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>]’
SDCClospre.cc:289:68: required from here
SDCCtree_dec.hpp:260:3: error: no match for ‘operator=’ in ‘G_sym = G’
SDCCtree_dec.hpp:260:3: note: candidate is:
In file included from /tmp/boost_1_52_0_beta1/boost/graph/graphviz.hpp:24:0,
                 from SDCClospre.hpp:22,
                 from SDCClospre.cc:24:
/tmp/boost_1_52_0_beta1/boost/graph/adjacency_list.hpp:313:21: note:
boost::adjacency_list<OutEdgeListS, VertexListS, DirectedS,
VertexProperty, EdgeProperty, GraphProperty, EdgeListS>&
boost::adjacency_list<OutEdgeListS, VertexListS, DirectedS,
VertexProperty, EdgeProperty, GraphProperty, EdgeListS>::operator=(const
boost::adjacency_list<OutEdgeListS, VertexListS, DirectedS,
VertexProperty, EdgeProperty, GraphProperty, EdgeListS>&) [with
OutEdgeListS = boost::vecS; VertexListS = boost::vecS; DirectedS =
boost::undirectedS; VertexProperty = boost::no_property; EdgeProperty =
boost::no_property; GraphProperty = boost::no_property; EdgeListS =
boost::listS; boost::adjacency_list<OutEdgeListS, VertexListS,
DirectedS, VertexProperty, EdgeProperty, GraphProperty, EdgeListS> =
boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS>]
/tmp/boost_1_52_0_beta1/boost/graph/adjacency_list.hpp:313:21: note:
no known conversion for argument 1 from ‘const
boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
cfg_lospre_node, float>’ to ‘const boost::adjacency_list<boost::vecS,
boost::vecS, boost::undirectedS>&’
In file included from /tmp/boost_1_52_0_beta1/boost/graph/graphviz.hpp:19:0,
                 from SDCClospre.hpp:22,
                 from SDCClospre.cc:24:
/tmp/boost_1_52_0_beta1/boost/property_map/property_map.hpp: In
instantiation of ‘void boost::put(const boost::put_get_helper<Reference,
PropertyMap>&, K, const V&) [with PropertyMap =
boost::vec_adj_list_vertex_all_properties_map<boost::adjacency_list<boost::vecS,
boost::vecS, boost::directedS>, boost::adjacency_list<boost::vecS,
boost::vecS, boost::directedS>*, boost::no_property,
boost::no_property&>; Reference = boost::no_property&; K = long unsigned
int; V = cfg_lospre_node]’:
/tmp/boost_1_52_0_beta1/boost/graph/copy.hpp:129:9: required from
‘void boost::detail::vertex_copier<Graph1, Graph2>::operator()(const
Vertex1&, Vertex2&) const [with Vertex1 = long unsigned int; Vertex2 =
long unsigned int; Graph1 = boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>; Graph2 =
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS>]’
/tmp/boost_1_52_0_beta1/boost/graph/copy.hpp:164:11: required from
‘static void boost::detail::copy_graph_impl<0>::apply(const Graph&,
MutableGraph&, CopyVertex, CopyEdge, Orig2CopyVertexIndexMap, IndexMap)
[with Graph = boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, cfg_lospre_node, float>; MutableGraph =
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS>;
CopyVertex =
boost::detail::vertex_copier<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>,
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> >;
CopyEdge = boost::detail::edge_copier<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>,
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> >;
IndexMap = boost::vec_adj_list_vertex_id_map<cfg_lospre_node, long
unsigned int>; Orig2CopyVertexIndexMap =
boost::iterator_property_map<__gnu_cxx::__normal_iterator<long unsigned
int*, std::vector<long unsigned int, std::allocator<long unsigned int> >
>, boost::vec_adj_list_vertex_id_map<cfg_lospre_node, long unsigned
int>, long unsigned int, long unsigned int&>]’
/tmp/boost_1_52_0_beta1/boost/graph/copy.hpp:348:5: required from
‘void boost::copy_graph(const VertexListGraph&, MutableGraph&) [with
VertexListGraph = boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, cfg_lospre_node, float>; MutableGraph =
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS>]’
SDCCtree_dec.hpp:155:3: required from ‘void
thorup_elimination_ordering(l_t&, const G_t&) [with l_t =
std::list<unsigned int>; G_t = boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>]’
SDCCtree_dec.hpp:272:3: required from ‘void
thorup_tree_decomposition(T_t&, const G_t&) [with T_t =
boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
tree_dec_lospre_node>; G_t = boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>]’
SDCClospre.cc:289:68: required from here
/tmp/boost_1_52_0_beta1/boost/property_map/property_map.hpp:361:5:
error: no match for ‘operator=’ in ‘(&((const
boost::vec_adj_list_vertex_all_properties_map<boost::adjacency_list<boost::vecS,
boost::vecS, boost::directedS>, boost::adjacency_list<boost::vecS,
boost::vecS, boost::directedS>*, boost::no_property,
boost::no_property&>&)pa))->boost::vec_adj_list_vertex_all_properties_map<Graph,
GraphPtr, Property,
PropertyRef>::operator[]<boost::adjacency_list<boost::vecS, boost::vecS,
boost::directedS>, boost::adjacency_list<boost::vecS, boost::vecS,
boost::directedS>*, boost::no_property, boost::no_property&>(k) = v’
/tmp/boost_1_52_0_beta1/boost/property_map/property_map.hpp:361:5: note:
candidate is:
In file included from
/tmp/boost_1_52_0_beta1/boost/graph/graph_traits.hpp:26:0,
                 from /tmp/boost_1_52_0_beta1/boost/graph/graphviz.hpp:21,
                 from SDCClospre.hpp:22,
                 from SDCClospre.cc:24:
/tmp/boost_1_52_0_beta1/boost/pending/property.hpp:18:10: note:
boost::no_property& boost::no_property::operator=(const boost::no_property&)
/tmp/boost_1_52_0_beta1/boost/pending/property.hpp:18:10: note: no
known conversion for argument 1 from ‘const cfg_lospre_node’ to ‘const
boost::no_property&’
In file included from /tmp/boost_1_52_0_beta1/boost/graph/graphviz.hpp:19:0,
                 from SDCClospre.hpp:22,
                 from SDCClospre.cc:24:
/tmp/boost_1_52_0_beta1/boost/property_map/property_map.hpp: In
instantiation of ‘void boost::put(const boost::put_get_helper<Reference,
PropertyMap>&, K, const V&) [with PropertyMap =
boost::adj_list_edge_all_properties_map<boost::directed_tag,
boost::no_property, boost::no_property&, boost::no_property*, long
unsigned int>; Reference = boost::no_property&; K =
boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>; V
= float]’:
/tmp/boost_1_52_0_beta1/boost/graph/copy.hpp:109:9: required from
‘void boost::detail::edge_copier<Graph1, Graph2>::operator()(const
Edge1&, Edge2&) const [with Edge1 =
boost::detail::edge_desc_impl<boost::bidirectional_tag, long unsigned
int>; Edge2 = boost::detail::edge_desc_impl<boost::directed_tag, long
unsigned int>; Graph1 = boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, cfg_lospre_node, float>; Graph2 =
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS>]’
/tmp/boost_1_52_0_beta1/boost/graph/copy.hpp:173:11: required from
‘static void boost::detail::copy_graph_impl<0>::apply(const Graph&,
MutableGraph&, CopyVertex, CopyEdge, Orig2CopyVertexIndexMap, IndexMap)
[with Graph = boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, cfg_lospre_node, float>; MutableGraph =
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS>;
CopyVertex =
boost::detail::vertex_copier<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>,
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> >;
CopyEdge = boost::detail::edge_copier<boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>,
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> >;
IndexMap = boost::vec_adj_list_vertex_id_map<cfg_lospre_node, long
unsigned int>; Orig2CopyVertexIndexMap =
boost::iterator_property_map<__gnu_cxx::__normal_iterator<long unsigned
int*, std::vector<long unsigned int, std::allocator<long unsigned int> >
>, boost::vec_adj_list_vertex_id_map<cfg_lospre_node, long unsigned
int>, long unsigned int, long unsigned int&>]’
/tmp/boost_1_52_0_beta1/boost/graph/copy.hpp:348:5: required from
‘void boost::copy_graph(const VertexListGraph&, MutableGraph&) [with
VertexListGraph = boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, cfg_lospre_node, float>; MutableGraph =
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS>]’
SDCCtree_dec.hpp:155:3: required from ‘void
thorup_elimination_ordering(l_t&, const G_t&) [with l_t =
std::list<unsigned int>; G_t = boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>]’
SDCCtree_dec.hpp:272:3: required from ‘void
thorup_tree_decomposition(T_t&, const G_t&) [with T_t =
boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
tree_dec_lospre_node>; G_t = boost::adjacency_list<boost::vecS,
boost::vecS, boost::bidirectionalS, cfg_lospre_node, float>]’
SDCClospre.cc:289:68: required from here
/tmp/boost_1_52_0_beta1/boost/property_map/property_map.hpp:361:5:
error: no match for ‘operator=’ in ‘(&((const
boost::adj_list_edge_all_properties_map<boost::directed_tag,
boost::no_property, boost::no_property&, boost::no_property*, long
unsigned int>&)pa))->boost::adj_list_edge_all_properties_map<Directed,
Property, PropRef, PropPtr, Vertex>::operator[]<boost::directed_tag,
boost::no_property, boost::no_property&, boost::no_property*, long
unsigned int>(k) = v’
/tmp/boost_1_52_0_beta1/boost/property_map/property_map.hpp:361:5: note:
candidate is:
In file included from
/tmp/boost_1_52_0_beta1/boost/graph/graph_traits.hpp:26:0,
                 from /tmp/boost_1_52_0_beta1/boost/graph/graphviz.hpp:21,
                 from SDCClospre.hpp:22,
                 from SDCClospre.cc:24:
/tmp/boost_1_52_0_beta1/boost/pending/property.hpp:18:10: note:
boost::no_property& boost::no_property::operator=(const boost::no_property&)
/tmp/boost_1_52_0_beta1/boost/pending/property.hpp:18:10: note: no
known conversion for argument 1 from ‘const float’ to ‘const
boost::no_property&’


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net