
Hi Guys, Here's some issues with this idea: Currently the vertex_descriptor for adjacency_list has no property-related type stuff in it, which allows adjacency_list_traits to work... that is, it is possible to determine the vertex_descriptor type without knowing the type of the vertex properties. This is important, for example, if you want an internal property containing a vertex descriptor (this is a circular dependency). vertex_descpriptor's are handles... passed by value. You would not want the City object copied, so the vertex descriptor would be a pointer to some object that inherits from City. However, dereferencing this pointer will add overhead to the execution time, especially in the case when a vertex_descriptor would have just been an int. Do you see solutions to these problems? Cheers, Jeremy On Apr 5, 2004, at 1:01 AM, Vladimir Prus wrote:
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
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Jeremy Siek <jsiek@osl.iu.edu> http://www.osl.iu.edu/~jsiek Ph.D. Student, Indiana University Bloomington Graduating in August 2004 and looking for work C++ Booster (http://www.boost.org) _______________________________________________