|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2004-04-02 10:49:33
On Friday 02 April 2004 07:35 am, Vladimir Prus wrote:
> One possible solution that I see is the make vertex_descriptor be always
> pointer type. It will point at some internal structure but also provide
> operator* which will return 'City'. Or, maybe, it should be possible to
> iterate over values of 'City', not only over values of vertex_descriptor.
>
> I still don't know if using City to identifiy vertices is feasible.
Why not make vertices derive from (or be aggregated with and convertable to)
City? It has a whole ton of advantages:
1) The user can just think of nodes as if they were City objects, including
easy access to City members.
2) Can trivially build a property map from a member pointer; wouldn't it be
nice to say:
dijsktra_shortest_paths(g, v, distance_map(&City::distance))
?
3) graph<Vertex, Edge, Rep> can have Rep=adjacency_list<whatever> as the
default representation, so we lose no genericity.
Oh, how I wish I had free time :)
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk