[bbost graph] need help on adjacency_list< ListS, ...

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. -- Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games! http://games.entertainment.gmx.net/de/entertainment/games/free

On Thu, Apr 3, 2008 at 5:59 PM, <lippmann2@gmx.de> 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

Hi Aaron your guess is correct, my code tis rying to add int values to the graph. is it a bad idea to use typedef std::pair <int, int> TEdge; for add_edge(...) to a graph, below is my relevant source code snippet. Best Bernhard -------------------------------------------------------------------------- iter = this->Elements.begin(); while(iter != this->Elements.end()) { aAtomicElement = (*iter).second; for (str_iter=aAtomicElement.AE_PinList.begin(); str_iter!= aAtomicElement.AE_PinList.end(); ++str_iter) for (str_iter2=str_iter+1; str_iter2!= aAtomicElement.AE_PinList.end(); ++str_iter2) { cout << "\n Params before call Add_edge(...) function \n "; cout << "edge as [<std::string>]: "<< *str_iter << " ::" << *str_iter2 << " \n "; cout << "edge as [<int> <int>] : "<< index_of_element( this->VertexNamesList, *str_iter) << " :: " << index_of_element( this->VertexNamesList, *str_iter2) << " \n "; OneEdge.first = index_of_element( this->VertexNamesList, *str_iter); OneEdge.second = index_of_element( this->VertexNamesList, *str_iter2); tie(e, inserted) = add_edge(OneEdge.first, OneEdge.second, g); if (inserted) { v = source(e, g); VertexNamesMap[v] = *str_iter; v = target(e, g); VertexNamesMap[v] = *str_iter2; EdgeNamesMap[e] = aAtomicElement.AE_Name; // EdgeIndexMap[e] = StrToInt(aAtomicElement.AE_ID); cout << " using Edge -->" << EdgeNamesMap[e] ; WeightMap[e] = 1 ; } } iter ++; } // while ... break; -- Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games! http://games.entertainment.gmx.net/de/entertainment/games/free
participants (3)
-
Aaron Windsor
-
bernhard lippmann
-
lippmann2@gmx.de