Boost logo

Boost Users :

Subject: Re: [Boost-users] Re. [Boost Graph] newbie - dijkstra & external weightmap
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2009-12-15 11:28:03

On Tue, 15 Dec 2009, Fergal Dalton wrote:

> Thanks again,
>> >
>> > But I'm talking about edge weights - why would you put in
>> > "get(vertex_index,g)" and not "get(edge_index,g)" or similar (I've tried
>> this
>> > simple substitution and it doesn't work; so it's obviously more complex
>> than
>> > that)?
>> OK. I misread that -- you do want edge_index. You will need to provide
>> them yourself, though. You must have some mapping from edges to numbers
>> already to index the vector; that needs to be turned into a property map.
> Exactly, that's the bit I can't understand. How do I do that? It's not a
> stupid question, I've been banging my head against it for 2 weeks but the
> documentation is full of examples far more complex than I need and I lose
> myself in the syntax (I'm a half-newbie to C++, which is not helping).

Create a bundled edge property in the graph (like you did for the weight
map before trying the external one). Write a loop over the edges of the
graph that assigns an index (in whichever way you are indexing the weight
vector) to each edge, putting it as the value of that property. Then use
that property map as the index map in the iterator_property_map. That
should give you an edge property that is based on your vector.

-- Jeremiah Willcock

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at