Boost logo

Boost Users :

Subject: Re: [Boost-users] [PropertyMap, Graph] Question on constructing a property map from a Cartesian product AxB of two sets to the set C of all real numbers
From: Alex Sadovsky (a_sadovsky_at_[hidden])
Date: 2012-06-12 19:55:18

Hello, I have defined a directed graph type, and a path type (each variable of type "path" is a sequence (vector) of vertices in the graph such that every two consecutive ones are connected by an edge).  Each path is parameterized by arc length. What I'd like to do is tabulate the function that, for each pair (vertex, path) tells the arc length coordinate of the vertex.  I don't want to make it a function: a pair (vertex, path) is likely to come up more than once, and I want to avoid repeating the computation of the arc length coordinate.  Just compute it once and store it in a property map. The code for the above definitions is below (P.S.).  Any help greatly appreciated. Thanks, Alex P.S. typedef boost::numeric::ublas::vector<double> EuclideanVector_t; typedef std::size_t VertexIndex_t; //  Information needed about a vertex: name and physical position struct VertexProperties {   VertexIndex_t VertexIndex;   std::string VertexName;   EuclideanVector_t VertexPhysicalPosition; }; struct EdgeProperties {   double EdgeEuclideanLength;   EuclideanVector_t EdgeUnitDirector; }; //   graph type (vertices are points in a Euclidean space, edges are rectilinear segments) typedef boost::adjacency_list<boost::vecS, boost::listS, boost::directedS, VertexProperties, EdgeProperties> GraphRectilinearEdges_t; //  Vertex iterator type typedef boost::graph_traits<GraphRectilinearEdges_t>::vertex_iterator GraphVertexIterator_t; //  Edge iterator type typedef boost::graph_traits<GraphRectilinearEdges_t>::edge_iterator GraphEdgeIterator_t; //  A path is a sequence of vertices in the Graph, implemented as vector whose entries are vertex indices class GraphPath_t {  private:   boost::numeric::ublas::vector<VertexIndex_t>;   double PathLength;  public: };

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at