Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-10-26 22:12:11


Hi Aaronyinyong,

When VertexList=vecS, the vertex_descriptor type happens to be int. When
VertexList=listS, the vertex_descriptor type is void*. In general, you
shouldn't count on the vertex_descriptor being a particular type. Look in
the example/ directory and grep for listS to find examples of creating a
graph in a way that avoids the dependence on having vertex_descriptor=int.

Cheers,
Jeremy

On Sat, 26 Oct 2002, aaronyinyong wrote:
aarony> compare the following codes:
aarony> 1.First I create Graph using vecS parameter:
aarony> typedef
aarony> boost::adjacency_list<vecS,vecS,directedS,VertexProperty,EdgeProperty>
aarony> Graph;
aarony> .....
aarony> E edge_array[num_edges]={E(0,1),E(0,2),E(0,3),E(2,3)};
aarony> boost::add_edge(edge_array[i].first,edge_array[i].second,g);
aarony> .....
aarony> This is OK!
aarony>
aarony> 2.Then I changed the parameter "vecS" to "listS".
aarony>
aarony> typedef
aarony> boost::adjacency_list<listS,listS,directedS,VertexProperty,EdgePropert
aarony> y> Graph;
aarony> .....
aarony> E edge_array[num_edges]={E(0,1),E(0,2),E(0,3),E(2,3)};
aarony> boost::add_edge(edge_array[i].first,edge_array[i].second,g);
aarony> It can't be compiled.The VC7 tells me "int can't be converted to
aarony> void*".
aarony>
aarony> So what's wrong? Is there any difference which could be caused by
aarony> "vecS" and "listS"?

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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