Boost logo

Boost :

From: Cromwell Enage (sponage_at_[hidden])
Date: 2006-07-13 09:15:46


--- Wang Weiwei wrote:
> > Thanks for your help. Would you pls give me an
> > example showing the usage of internal property
> > map for the vertices and edges?
>
> or, to make the question simpler, how to declare
> an adjacency_list type graph object with internal
> vertex/edge property maps as follows:
>
> vertex descriptor -> MyVpmType
> edge descriptor -> MyEpmType

struct elem_id_t
{
    typedef boost::vertex_property_tag kind;
};

struct edge_id_t
{
    typedef boost::edge_property_tag kind;
};

typedef boost::property<elem_id_t, char>
        MyVpmType;
typedef boost::property<edge_id_t, std::string>
        MyEpmType;
typedef boost::adjacency_list<
            boost::listS
          , boost::vecS
          , boost::directedS
          , MyVpmType
          , MyEpmType
>
        Graph;

Graph g;

> And how to access the internal maps to do sum
> get/put operation?

boost::property_map<Graph, elem_id_t>::type
    vertex_map = boost::get(elem_id_t(), g);
boost::property_map<Graph, edge_id_t>::type
    edge_map = boost::get(edge_id_t(), g);

                              Cromwell D. Enage

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


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