Boost logo

Boost Users :

From: Stephan Höfer (yg-boost-users_at_[hidden])
Date: 2003-08-06 01:34:56


the original graph looks like that

0--1--2--3
 | | | |
7--6--5--4

the subgraph looks like that
0--1--2
      | |
     6--5

typedef boost::property<boost::vertex_color_t, boost::default_color_type,
boost::property< boost::vertex_predecessor_t, vertex_descriptor > >
VertexProperty;

typedef boost::property<boost::edge_color_t, boost::default_color_type,
boost::property<boost::edge_weight_t, int,
boost::property<boost::edge_index_t, int > > > EdgeProperty;

typedef boost::subgraph< boost::adjacency_list<boost::vecS, boost::vecS,
boost::undirectedS,
  VertexProperty, EdgeProperty > > Graph;

void main()
{
Graph g(7);

boost::property_map<Graph, boost::edge_weight_t>::type weightmap =
boost::get(boost::edge_weight, g);
Edge e; bool inserted;

boost::tie(e, inserted) = boost::add_edge(0, 1, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(1, 2, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(2, 3, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(3, 4, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(4, 5, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(5, 2, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(5, 6, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(6, 1, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(6, 7, g); weightmap[e] = 1;
boost::tie(e, inserted) = boost::add_edge(7, 0, g); weightmap[e] = 1;

Graph& tSubGraph = g.create_subgraph();

add_vertex(0,tSubGraph); add_vertex(1,tSubGraph); add_vertex(2,tSubGraph);
add_vertex(5,tSubGraph); add_vertex(6,tSubGraph);

std::vector < boost::graph_traits < Graph >::vertex_descriptor>
p(boost::num_vertices(tSubGraph));
boost::prim_minimum_spanning_tree(tSubGraph, &p[0]);
}

The crash happens after having added for instance the 6th point of the Graph
g to the subgraph. Before it worked.

Jeremy Siek schrieb:

> I haven't been following the thread, but if you post a small (less than
> one page) but complete
> example program that exhibits the crash I'd be willing to take a look.
>
> Cheers,
> Jeremy
>
> On Tuesday, August 5, 2003, at 02:21 AM, Stephan Höfer wrote:
>
> > Thank you for the hint. I've overseen that. But beside that there must
> > be another mistake, because it crashes again
> > after that slight change of the code.
> >
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


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