Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-04-05 01:01:04

Douglas Gregor wrote:

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

This would be nice, really!

> 3) graph<Vertex, Edge, Rep> can have Rep=adjacency_list<whatever> as the
> default representation, so we lose no genericity.

I see only one problem. If vertex== some class derived from City, then
the vertex itself, as well as vector<vertex> might be very large and current
BGL passes/stores vertices by value almost everywhere.

The point about operator* is that it allows access to City (though less
convenient), but does significally affect performance.

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at