Boost logo

Boost Users :

From: Ramy Sadek (sadek_at_[hidden])
Date: 2007-04-13 18:56:32


Hello All,

 

I'm using Boost for a work project, and trying to encourage others to
use boost for work as well. I've hit a snag using BGL which is hindering
that effort.

 

I defined have a class which creates a graph from a graphviz file and
uses a dynamic_property_map. I adopted some code straight from the
python graphviz example class. My class (mGraph) is defined as follows:

 

class basic_graph

                        : public stored_minstd_rand,

                        public adjacency_list<listS, listS, DirectedS,

                        property<vertex_index_t, std::size_t>,

                        property<edge_index_t, std::size_t> >

 

typedef basic_graph<bidirectionalS> Digraph;

 

typedef boost::graph::python::Digraph mGraph;

 

 

I have a function that takes in a graph, destructively extracts
information from it, while storing the vertex information of visited
vertices. I later queries the properties associated with those vertices.
Passing by reference allows me to retrieve properties as needed, but
destroys the original graph, preventing further processing. So I cobbled
together a copy constructor so I could pass by value, but since the
vertices are copies of the originals calling attempting to get() a
property fails. I don't fully understand the reason for this, but I
believe it is a deep vs shallow copy problem.

 

My attempts to use copy_graph() have also failed as my graph uses listS
instead of vecS. Changing the template argument to vecS causes internal
compiler errors using VS 7.1.

 

So I have two questions. First, how can I modify my class so that it
works with copy_graph. Second, how can I implement a copy-constructor
that will preserve the dynamic property map and full vertex info so that
get() on the copy's properties behaves correctly? Is this even
desirable, or does copy-construction have undesirable implications here?

 

Thanks!

 

-Ramy



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