Boost logo

Boost Users :

From: Vivid Yang (yyd_iris_at_[hidden])
Date: 2005-04-05 09:09:24


Hi,

I saw all the BGL examples begin with enumeration:
    // Make convenient labels for the vertices
    enum { Amherst, Boston, City, Denver, Egypt, Niagara };
So it is convenient to access properties, for example:
    distance(Boston) = 50; //distance is a property of vertices

The problem is that I have to build my graph incrementally and might have to
remove some vertices later. So enumeration does not work for me.
When I want to set distance(Boston) = 50, I have to find the descriptor for
"Boston" first, (It takes O(n) to traverse all the vertices). It is too
expensive for a large graph.

Is there anyway I can skip this step? I am thinking add a hash table, which
maps each city to a descriptor. I have to update the hash table whenever I
remove vertices. It is inconvenient neither.

Do I think it in the right way? Any suggestions?

Thanks a lot.
Vivid


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