Saturday, 15 May 2010

c++ - Boost BGL Dijkstra Shortest Paths -


I'm not familiar with boost libraries and am trying to learn. I used the Bust Graphics Library to call at least routes of the Dzestra to find a path to the destination in a map. Verticals are intersection and edges are road segments

For the least time I am getting the shortest route, for this, I have the width of the edges defined as the time limit, time = St. block length * Its speed / Bound It actually gives me less time (up to time) However, I also account for a turn and add 15 seconds to each of the total time. How do I find out that a twist is given two road blocks (edges), if the second name is not equal to the first Saint name, then this is a turn.

Actually, I want to weights (not just in the beginning, as I am doing here). When the program touches an edge during the search, I want to check it at this level (parent or previous). How can I do this in a function or another argument that can do this?

vector & lt; Unsigned & gt; OurGraph :: find_awesome_path (unsigned start, unsigned complete) {// Start and end in intersection ID, // get related verses in graph Vertex start_node = vertex_map [Start]; Vertex dest_node = vertex_map [finish]; Std :: vector & lt; Vertex & gt; Predecessors (boost: num_vertices (my_graph)); // Std :: vector to store the parents & lt; Float & gt; Distance (boost: num_vertices (my_graph)); // IndexMap indexMap = boost :: get (boost :: vertex_index, my_graph) to store secondary distance; Preceding map preceding map (and predecessor [0], indexmap); Distance map distance (and distance [0], indexmap); Boost :: dijkstra_shortest_paths (my_graph, start_node, boost :: distance_map (distance map) .predecessor_map (predecessorMap)); Of vector & lt; Edge & gt; Path; Path = get_edge_path (dest_node, predecessorMap); // Removes the edges from the details of the edge in the previous map and piled them in a vector in the edge. Return segment_list_frame_edge (path); // Road segment ID and return edges to return. }

where my_graph is a type of graph and graphs, vertices, edges, indexmaps, predesorption and < Em> distance map types are defined as the following:

  typedef boost :: property & lt; Boost :: edge_weight_t, float & gt; WeightProperty; Typedef boost :: property & lt; Promotion: vertex_name_t, unsigned & gt; IntersectionProperty; Typedef boost :: adjacency_list & lt; Promotion: List S, Promotion :: VCS, Promotion :: Director, Interaction Property, Wetproperty & gt; Graph; Typedef boost :: graph_traits & lt; Graph & gt; :: vertex_descriptor vertex; Typedef boost :: graph_traits & lt; Graph & gt; :: Age_descriptor edge; Typedef Promotion: Property_map & lt; Graph, boost :: vertex_indx_t & gt; :: type indexmap; Typedef boost :: iterator_property_map & lt; Vertex *, IndexMap, Vertex, Vertex and Embedded & Gt; PredecessorMap; Typedef boost :: iterator_property_map & lt; Float *, indexmap, float, float & amp; & Gt; DistanceMap;  

You can do this using a difference graph in that case the difference graph In each head will be equal to the edge of your current graph. Then a top example would encapsulate a turn, then you can rotate the edges in which the change in the name of the road (or whatever mechanism you use, to change the use.)


No comments:

Post a Comment