Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] Problem trying to delete vertices from a graph using named vertices, please help!
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-03-30 08:39:46


On Mon, 29 Mar 2010, Camillo Anania wrote:

> 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:

What is Vertex defined as here?

> 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_in
> dex_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);
> }
> }
> }

What is Osm::Vertex, and what does osm_get_vertex do?

> 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;

Are you perhaps using a different vertex type in this case?

-- Jeremiah Willcock


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