Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2003-11-14 11:02:02


Hi Tarjei,

On Friday, November 14, 2003, at 05:33 AM, Tarjei Knapstad wrote:
> On Thu, 2003-11-13 at 17:09, Jeremy Siek wrote:
>> Hi Tarjei,
>>
>> You need to initialize the edge index property map (only the vertex
>> index
>> map is automatically initialized, and then only for VertexList=vecS).
>>
>
> Hmm, ok, but I still don't quite understand. I thought that
> initializing
> the std::vector holding the colors was sufficient...? To my
> understanding an iterator_property_map is just a property map which
> iterates through some other container (that can provide a
> RandomAccessIterator) actually holding the properties?

Yes, your edge color map is initialized just fine, but you also need to
initialize the edge index map.

Here's the reason why: your edge color map uses the edge index map
to go from an edge descriptor to an integer offset, which is then used
to
access into the color vector.

Currently, your edge index map is initialized to random garbage, so you
are going out-of-bounds when accessing the edge color vector.

See the example file exterior_properties.cpp,

BTW, you don't need to declare an edge_color property for the
adjacency_list because you are using an external edge color map.

>
> Obviously there's some connection I don't quite get here... I also
> don't
> quite understand the EColorValue uv_color = get(edge_color, *ei); call
> in undir_dfv_impl. It asks for the edge_color at the edge_descriptor
> *ei, but from where?
>
> Anyway, I don't really even need an edge_index property here (or do
> I?),
> it was more or less to try to get this working.

Yes, you need it for the reason given above.

BTW, if you switch to using an internal edge color property, then you
won't
need the edge index property, or the edge color vector.

Cheers,
Jeremy


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