|
Boost Users : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2003-08-06 09:54:08
Hi Stephan,
What you've posted is not a complete program (it is missing at least the
#include's). Please post a complete program.
Thanks,
Jeremy
P.S. Sorry to be pedantic about this, but I've wasted a lot of time in the
past trying to reconstruct complete programs from incomplete programs.
On Wed, 6 Aug 2003, Stephan [iso-8859-1] Höfer wrote:
yg-boo> the original graph looks like that
yg-boo>
yg-boo> 0--1--2--3
yg-boo> | | | |
yg-boo> 7--6--5--4
yg-boo>
yg-boo> the subgraph looks like that
yg-boo> 0--1--2
yg-boo> | |
yg-boo> 6--5
yg-boo>
yg-boo> typedef boost::property<boost::vertex_color_t, boost::default_color_type,
yg-boo> boost::property< boost::vertex_predecessor_t, vertex_descriptor > >
yg-boo> VertexProperty;
yg-boo>
yg-boo> typedef boost::property<boost::edge_color_t, boost::default_color_type,
yg-boo> boost::property<boost::edge_weight_t, int,
yg-boo> boost::property<boost::edge_index_t, int > > > EdgeProperty;
yg-boo>
yg-boo> typedef boost::subgraph< boost::adjacency_list<boost::vecS, boost::vecS,
yg-boo> boost::undirectedS,
yg-boo> VertexProperty, EdgeProperty > > Graph;
yg-boo>
yg-boo> void main()
yg-boo> {
yg-boo> Graph g(7);
yg-boo>
yg-boo> boost::property_map<Graph, boost::edge_weight_t>::type weightmap =
yg-boo> boost::get(boost::edge_weight, g);
yg-boo> Edge e; bool inserted;
yg-boo>
yg-boo> boost::tie(e, inserted) = boost::add_edge(0, 1, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(1, 2, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(2, 3, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(3, 4, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(4, 5, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(5, 2, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(5, 6, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(6, 1, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(6, 7, g); weightmap[e] = 1;
yg-boo> boost::tie(e, inserted) = boost::add_edge(7, 0, g); weightmap[e] = 1;
yg-boo>
yg-boo> Graph& tSubGraph = g.create_subgraph();
yg-boo>
yg-boo> add_vertex(0,tSubGraph); add_vertex(1,tSubGraph); add_vertex(2,tSubGraph);
yg-boo> add_vertex(5,tSubGraph); add_vertex(6,tSubGraph);
yg-boo>
yg-boo> std::vector < boost::graph_traits < Graph >::vertex_descriptor>
yg-boo> p(boost::num_vertices(tSubGraph));
yg-boo> boost::prim_minimum_spanning_tree(tSubGraph, &p[0]);
yg-boo> }
yg-boo>
yg-boo> The crash happens after having added for instance the 6th point of the Graph
yg-boo> g to the subgraph. Before it worked.
yg-boo>
----------------------------------------------------------------------
Jeremy Siek http://php.indiana.edu/~jsiek/
Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------
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