|
Boost : |
Subject: [boost] [bgl] Transitive closure
From: Gustavo Gutiérrez (gutierrez.gustavo_at_[hidden])
Date: 2009-08-13 14:27:43
Hello,
I am trying to compute the transitive closure of a graph. The
definition of the graph is:
typedef boost::adjacency_list<boost::vecS, boost::listS,
boost::bidirectionalS,
boost::property<boost::vertex_name_t, int> > graph_t;
The code that calls the transitive closure function is: (g is of type
graph_t)
// prepare a map Vertex-int.
map<Vertex,int> extmap;
VertexIt vi, v_end;
int i = 0;
for (tie(vi,v_end) = vertices(g); vi != v_end; ++vi, i++) {
extmap.insert(pair<Vertex,int>(*vi,i));
}
associative_property_map<map<Vertex,int> > tempMap(extmap);
map<Vertex,Vertex> vmap;
adjacency_list<> c;
boost::transitive_closure(g, c, vmap, tempMap);
According with the documentation, tempMap must be a map from vertices
to integers. When I try to compile the program, the following error
occurs:
/usr/local/include/boost/graph/transitive_closure.hpp:182: error:
invalid initialization of reference of type 'const std::vector<long
unsigned int, std::allocator<long unsigned int> >&' from expression of
type 'std::vector<int, std::allocator<int> >'
After taking a look at the file, the vector successors is defined as:
std::vector<std::vector<cg_vertex> > successors(...);
The error occurs with the following call:
detail::union_successor_sets(successors[u], successors[v],
successors[u]);
the definition of union_successor_sets is:
inline void union_successor_sets(const std::vector < std::size_t > &s1,
const std::vector < std::size_t > &s2,
std::vector < std::size_t > &s3) {...}
Probably I am really wrong, but successors[u] is an
std::vector<cg_vertex> and the function expects a std::vector <
std::size_t >. So size_t and cg_vertex should be the same type, which
according with the error reported by the compiler is not true.
Can someone give me a hint on how to solve my problem?
Thaks in advance.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk