The following code returns a "negative edge weight" on a call to prim_minimum_spanning_tree , although I only use positive numbers. What needs to be changed to make it work?
typedef boost::property<vertex_distance_t, int> VertexProperty; typedef boost::property<edge_weight_t, int> EdgeProperty; typedef adjacency_list<vecS, vecS, undirectedS, VertexProperty, EdgeProperty> Graph; typedef pair<int, int> Edge; Edge edges[] = {Edge(0, 1), Edge(1, 2)}; int weights[] = {2, 1};
Note. I can succeed by changing the weight values.
Compiler: MS Visual Studio 2010 C ++ Version for Boost: 1.54
alexm source share