BGL - VertexList of adjacency_list = boost::setS?

Is there some reason why the vertexlist parameter of adjacency_list cannot be of "setS" type? If I do something like: typedef boost::adjacency_list<boost::listS,boost::setS> Graph; Graph g; boost::add_edge(0,1, g); I always get this error: Error 1 error C2664: 'std::pair<_Ty1,_Ty2> boost::add_edge<boost::detail::adj_list_gen<Graph,VertexListS,OutEdgeListS,DirectedS,VertexProperty,EdgeProperty,GraphProperty,EdgeListS>::config>(void *,void *,boost::directed_graph_helper<Config> &)' : cannot convert parameter 2 from 'int' to 'void *' c:\mycode\boosttest\boosttest\boosttest.cpp 18 If I change it to vecS, then it works. I know the std::set is somehow different from vector or list, but since I don't understand it so well, I don't know why the vertexList cannot be setS, and for example OutEdgeList (1st parameter of adjacency_list) can. Thanks for clarifynig.

typedef boost::adjacency_list<boost::listS,boost::setS> Graph; Graph g; boost::add_edge(0,1, g);
0 and 1 are not descriptors if you use any selector other than vecS, hence the "cannot convert" error. There should be a function vertex(n, g) that you can use to return a descriptor to the nth vertex in these cases, but be forewarned: it's O(V). add_edge(vertex(0), vertex(1), g); Andrew Sutton andrew.n.sutton@gmail.com
participants (2)
-
Andrew Sutton
-
Ondrej Sluciak