[BGL] Obtaining corresponding vertex_descriptors
Suppose we have two BGL graphs g1 and g2, of type Graph1 and Graph2 respectively, such that g2 is a copy of g1. Given a vertex_descriptor v1 belonging to g1, can one generically obtain the corresponding vertex descriptor for g2: a) if Graph1 and Graph2 are actually the same type b) if Graph1 and Graph2 are different types? Regards, Jerry.
J Swan wrote:
Suppose we have two BGL graphs g1 and g2, of type Graph1 and Graph2 respectively, such that g2 is a copy of g1. Given a vertex_descriptor v1 belonging to g1, can one generically obtain the corresponding vertex descriptor for g2:
a) if Graph1 and Graph2 are actually the same type
If both use vecS for vertices, then
v2 = v1;
If both use listS for vertices, then you either need to manipulate
iterators, or you need to create
vector_property_map
b) if Graph1 and Graph2 are different types?
You need to create a map. The copy_graph function allows you to pass an argument where the mapping will be stored. - Volodya
participants (2)
-
J Swan
-
Vladimir Prus