|
Boost Users : |
Subject: Re: [Boost-users] [Graph] Problem trying to delete vertices from a graph using named vertices, please help!
From: Camillo Anania (anacron10_at_[hidden])
Date: 2010-03-29 13:58:51
> Hi guys,
> I have a graph so defined:
> typedef boost::adjacency_list<boost::listS, boost::listS, boost::bidirectionalS, Osm::VertexProperties, EdgeProperties> Graph;
> Graph osmGraph;
>
> I'm trying to delete some vertices from osmGraph using the usual remove_vertex(Vertex, Graph) but I get the following error from Visual Studio 2008 when compiling:
> boost_1_40_0\boost/graph/named_graph.hpp(349) : error C2664: 'boost::multi_index::detail::hashed_index_iterator<Node,BucketArray> boost::multi_index::detail::hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>::erase(boost::multi_index::detail::hashed_index_iterator<Node,BucketArray>)' : cannot convert parameter 1 from 'void *' to 'boost::multi_index::detail::hashed_index_iterator<Node,BucketArray>'
> the code I use is:
> {
> vector<int> component(num_vertices(osmGraph));
> int num = strong_components(osmGraph,
> make_iterator_property_map(&component[0], get(&Osm::VertexProperties::id, osmGraph)),
> vertex_index_map(get(&Osm::VertexProperties::id, osmGraph)));
> int main_comp = component[depotID];
> for (int i = 0; i != component.size(); i++){
> if (component[i] == main_comp)
> continue;
> if (is_incident_to_required_edge(osmGraph, i)){
> cerr << "Required components on input topology are not strongly connected. Check the input .osm file" << endl;
> return 1;
> }
> else {
> clear_vertex(osm_get_vertex(i, osmGraph), osmGraph);
> Osm::Vertex osm_v = osm_get_vertex(i, osmGraph);
> cout << "id=" << osmGraph[osm_v].id << endl;
> remove_vertex(osm_v, osmGraph);
> }
> }
> }
> why it doesnt work? why the same code with the graph defined in the following way works?
> typedef adjacency_list < listS, listS, bidirectionalS, property < vertex_name_t, std::string,
> //vertex property
> property < vertex_unique_id_t, int, property < vertex_color_t, boost::default_color_type> ............. >,
> //edge property
> property < edge_index_t, int, property < edge_num_bins_t, int, property < edge_unique_id_t, int, property < edge_name_t, std::string> ..............>
> > Graph;
> PLEASE help.
> Camillo
> Ciao
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