compare the following codes: 1.First I create Graph using vecS parameter: typedef boost::adjacency_list<vecS,vecS,directedS,VertexProperty,EdgeProperty> Graph; ..... E edge_array[num_edges]={E(0,1),E(0,2),E(0,3),E(2,3)}; boost::add_edge(edge_array[i].first,edge_array[i].second,g); ..... This is OK! 2.Then I changed the parameter "vecS" to "listS". typedef boost::adjacency_list<listS,listS,directedS,VertexProperty,EdgePropert y> Graph; ..... E edge_array[num_edges]={E(0,1),E(0,2),E(0,3),E(2,3)}; boost::add_edge(edge_array[i].first,edge_array[i].second,g); It can't be compiled.The VC7 tells me "int can't be converted to void*". So what's wrong? Is there any difference which could be caused by "vecS" and "listS"?
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@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------
participants (2)
-
aaronyinyong
-
Jeremy Siek