Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-12-16 04:39:06


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<graph_traits<Graph>::vertex_description> m;

and initialize by parallel vertex traversal before doing mapping.

> 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


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