From: Shalmali Bodas (shalmalib_at_[hidden])
Date: 2008-04-28 15:25:23


Hi,

I am fairly new to the Boost Graph Libraries and am facing a problem in my
code. I would appreciate your help with it.

I have a program which already uses the BGL successfully. I just tried to
implement as additional thing based on similar lines as existing code but
the program gives me a "Segmentation Fault".
[i am trying to define a New Custom vertex property called vertex_length (
in addition to earlier defined ones like
vertex_coordinate_r,vertex_coordinate, vertex_depth) which gives distance
from a root vertex to vertex under consideration]

The.hpp contains:

namespace boost {
  enum vertex_coordinate_t {vertex_coordinate = 1000};
  enum vertex_coordinate_r_t {vertex_coordinate_r = 1001};
  enum vertex_depth_t {vertex_depth = 1002};
  enum vertex_length_t {vertex_length = 1003};
  enum edge_generation_t {edge_generation = 1004};

  BOOST_INSTALL_PROPERTY(vertex, coordinate);
  BOOST_INSTALL_PROPERTY(vertex, coordinate_r);
  BOOST_INSTALL_PROPERTY(vertex, depth);
  BOOST_INSTALL_PROPERTY(vertex, length); *// Line added by me*
  BOOST_INSTALL_PROPERTY(edge, generation);
}

  typedef boost::property<boost::vertex_coordinate_t, Coordinate3D,
           boost::property<boost::vertex_coordinate_r_t, Coordinate3D,
           boost::property<boost::vertex_depth_t, int,
           boost::property<boost::vertex_length_t, int > > > >
VertexProperty;
  typedef boost::property<boost::edge_generation_t, int> EdgeProperty;

and later on inside a class:

typedef boost::property_map<graph_t, boost::vertex_coordinate_t>::type
v_coordinate_map_t;
typedef boost::property_map<graph_t, boost::vertex_coordinate_r_t>::type
v_coordinate_r_map_t;
typedef boost::property_map<graph_t, boost::vertex_depth_t>::type
v_depth_map_t;
 typedef boost::property_map<graph_t, boost::vertex_length_t>::type
v_length_map_t; *// Line added by me*
 typedef boost::property_map<graph_t, boost::edge_generation_t>::type
e_generation_map_t;

..............................................and so on..

 While debugging, I have noticed that in the constructor -

m_v_vertex_PROPERTY = boost::get(boost::vertex_PROPERTY, mygraph) where
PROPERTY is either vertex_coordinate_r, vertex_coordinate, vertex_depth

works well but does not work for vertex_length. When watched, the variable
m_v_vertex_length gives "No symbol "m_v_vertex_length" in current context".

I think there is problem in installing the property. What could be going
wrong?
Thanks for your help.