Boost logo

Boost Users :

Subject: Re: [Boost-users] Iterating over vertices in a specific region in a graph
From: David Doria (daviddoria_at_[hidden])
Date: 2012-01-22 16:06:46


> You would need to do that by hand; note that there is a function to convert
> from coordinates to graph vertices.
>
> -- Jeremiah Willcock

Hi Jeremiah,

You mean there is something more "built in" than this: ?

#include "boost/graph/adjacency_list.hpp"
#include "boost/graph/simple_point.hpp"

namespace boost {
  enum vertex_coordinate_t { vertex_coordinate };
  BOOST_INSTALL_PROPERTY(vertex, coordinate);
};

int main(int argc, char *argv[])
{
  typedef boost::simple_point<float> PointType;

  typedef boost::adjacency_list<boost::vecS,
                                boost::vecS,
                                boost::undirectedS,
                                boost::property<
boost::vertex_coordinate_t, PointType >
                                > Graph;
  Graph g;

  typedef typename boost::property_map<Graph,
boost::vertex_coordinate_t>::type CoordinatePropertyMap;
  CoordinatePropertyMap coordinatePropertyMap =
get(boost::vertex_coordinate, g);

  return 0;
}

(i.e. can you point me to the function you are talking about : ) ?)

Also, the reason I am not using boost::grid_graph is that there are
"holes" in my graph - i.e. not every integer coordinate has a vertex.
Does the coordinate-to-vertex_descriptor function you are talking
about handle the case when a vertex doesn't exist at the specified
coordinate?

Thanks,

David


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