Boost logo

Boost Users :

From: Aaron Windsor (aaron.windsor_at_[hidden])
Date: 2008-04-06 17:37:43


On Thu, Apr 3, 2008 at 5:59 PM, <lippmann2_at_[hidden]> wrote:
> To use the remove_edge() function I have to change my graph definition from typedef adjacency_list< vecS, vecS, ....> to adjacency_list< ListS, listS, ....> .
>
> now the add_edge (...) function gives me an error while compiling:
>
> 'boost::add_edge' : cannot convert parameter 1 from 'int' to 'void *'
>
>
> what does this mean ????
>
> also using these typedefs:
>
> typedef graph_traits < TGraph >::vertex_descriptor Tvertex_descriptor;
> typedef graph_traits < TGraph >::edge_descriptor Tedge_descriptor;
> typedef graph_traits <TGraph>::vertex_iterator Tvertex_iter;
> typedef graph_traits <TGraph>::edge_iterator Tedge_iter;
>
> seems to be no good idea, because I get many compiler errors now?
> Any help is welcome.

Most likely, you're trying to pass integers to add_edge instead of
using vertex descriptors. You should be passing vertex descriptors to
add_edge that you've obtained either by iterating over the vertices in
the graph or as a result of calling add_vertex. For example,

Tvertex_descriptor u = add_vertex(g);
Tvertex_descriptor v = add_vertex(g);
add_edge(u,v,g);

or, if you really need to refer to them as integers, iterate through
all of the vertices, put them in a std::vector<Tvertex_descriptor>
my_vertices, and you can call add_edge(my_vertices[i],
my_vertices[j],g) for any i,j in the appropriate range.

Regards,
Aaron


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