Vertexes in my graph have the distance and predecessor properties.
These properties at each vertex are vectors: they store distances and
predecessor of shortest paths to every other node in the graph.
Below is my program. I run the program and as input I give the file
also listed below, and get this run-time error:
*** glibc detected *** free(): invalid next size (fast): 0x085dd110
I would appreciate your advice on what I'm doing wrong.
Best,
Irek
**********************************************************************
#include <string>
#include
#include
#include
#include
using namespace std;
using namespace boost;
typedef
adjacency_list_traits::vertex_descriptor
Vertex;
typedef
boost::adjacency_list > >,
property > >
Graph;
int
main ()
{
Graph g;
dynamic_properties dp;
dp.property("node_id", get(vertex_name, g));
dp.property("distance", get(edge_weight, g));
dp.property("lambdas", get(edge_weight2, g));
read_graphviz(cin, g, dp);
BGL_FORALL_VERTICES(v, g, Graph)
{
get(vertex_distance, g, v).resize(num_vertices(g));
get(vertex_predecessor, g, v).resize(num_vertices(g));
dijkstra_shortest_paths
(g, v, predecessor_map(&get(vertex_predecessor, g, v)[0]).
distance_map(&get(vertex_distance, g, v)[0]));
}
}
**********************************************************************
Graph {
a;
b;
c;
d;
e;
f;
a -- b [distance = "100", lambdas = "10"]
b -- c [distance = "200", lambdas = "10"]
c -- d [distance = "80", lambdas = "10"]
b -- e [distance = "40", lambdas = "10"]
c -- f [distance = "100", lambdas = "10"]
a -- e [distance = "210", lambdas = "10"]
e -- f [distance = "340", lambdas = "10"]
f -- d [distance = "50", lambdas = "10"]
}