Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2000-12-07 12:35:21


Using the vertex_descriptor or edge_descriptor objects directly as keys is
not going to work. Instead you need to create vertex_index or edge_index
properties that are associated with each vertex or edge. Use internal
properties for these indices. Note that if you use adjacency_list with
VertexList=vecS then the vertex_index property is automatically there.
However, for edge_index and vertex_index when VertexList!=vecS you need to
explicitly add the index properties.

Once you have the index properties, you can use these indices as keys
in the map.

There's an example of this in
boost/libs/graph/examples/exterior_properties.cpp. However, instead
of using std::map, the example uses std::vector for the external
properties. If you look in random_access_iterator_property_map
(in boost/boost/property_map.hpp) you will see it converts from
descriptor to index using an index property map.

Cheers,

Jeremy

On Thu, 7 Dec 2000, Krishna Padmasola wrote:

> Hi Jeremy,
>
> We are using map<edge_descriptor, int> for keeping track of some
> temporary properties on graph edges in our algorithm. but it does not
> work in some cases especially when the graph is undirected and there are
> cycles in the graph.
>
> Is this a known bug/feature? What is the suggested way to go about doing
> this? Can we use external properties for this? If so how? I have only
> seen examples where the external property is stored at the time of
> adding edges to the graph and that too for vecS representation, not
> listS representation of edges. I need to add external properties at
> various times to the edges of the graph, and I am using listS
> representation.
>
> Any help is appreciated.
>
> regards,
> Krishna.
>
>
>
>

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk