BGL - VertexList of adjacency_list = boost::setS?

View: New views
2 Messages — Rating Filter:   Alert me  

BGL - VertexList of adjacency_list = boost::setS?

by oslu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: BGL - VertexList of adjacency_list = boost::setS?

by Andrew Sutton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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@...

_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users