|
Boost : |
From: Wang Weiwei (wwwang_at_[hidden])
Date: 2006-07-13 21:13:06
Hello Enage,
Thank you so much for your help and sample code.
One more question is: :-)
If MyVPropType and MyEPropType are 2 user-defined typenames already exist
that I want the vertex/edge descriptors to map into.
e.g.
class MyVPropType
{
std::vector<int> v;
std::map<int, std::string> m;
}
class MyEPropType
{
double weight;
std::string path_name;
}
And I also need two user types as the vertex/edge descriptors,
e.g.
-vertex descriptor type
class MyVDescriptor
{
std::pair<int, std::string>;
// sth else
}
-edge descriptor type
class MyEDescriptor
{
std::string name;
boost::array<int, 10> array;
}
(all of the above user types are somewhat complex intentionally but I think this does not matter,
is it?)
Additionally, while using these user maps, I want also retain the default color map for the vertices.
How to write the code (using an adjacency_list graph class)?
Thanks again.
Max
>--- 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
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
= = = = = = = = = = = = = = = = = = = =
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
Àñ£¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Wang Weiwei
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡wwwang_at_[hidden]
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2006-07-14
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk