Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2004-05-01 00:12:44


Hi Hugues,

The bug is in your program, not in the BGL.

The first invocation of remove_vertex invalidates all of the
vertex descriptors in the array. Thus the following calls
to remove_vertex are being passed invalid vertex descriptors,
which does not have defined behaviour.

If you want vertex descriptor stability, use listS for the
VertexList parameter of adjacency_list.

-Jeremy

On Apr 30, 2004, at 7:28 AM, Hugues Joly wrote:

> Hi,
> I have found a bug with the adjacency_list. It
> seems that there's a bug with the deletion of a
> vertex.
>
> See the attachment for a small program that triggers
> the problem.
>
> Thanks in advance.
>
> __________________________________________________________
> Lèche-vitrine ou lèche-écran ?
> magasinage.yahoo.ca// test.cpp : Defines the entry point for the
> console application.
> //
>
> #include "stdafx.h"
> #include <boost/config.hpp>
> #include <iostream>
> #include <boost/graph/subgraph.hpp>
> #include <boost/graph/adjacency_list.hpp>
> #include <boost/graph/graph_utility.hpp>
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> using namespace boost;
> //typedef adjacency_list_traits<vecS, vecS, directedS> Traits;// Does
> nothing?
> typedef boost::property<boost::vertex_color_t, int,
> boost::property< boost::vertex_name_t, std::string > >
> VertexProperty;
>
> typedef adjacency_list<vecS, vecS, directedS, VertexProperty,
> property<edge_index_t, int> > Graph;
>
> Graph G0;
> Graph::vertex_descriptor v_descr[4];
> Graph::edge_descriptor e_descr[4];
>
> for (int i = 0; i < 4; i++)
> {
> v_descr[i] = boost::add_vertex(G0);
> }
>
> for (int i = 0; i < 4; i++)
> {
> boost::remove_vertex(v_descr[i], G0);
> }
>
> return 0;
> }
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Jeremy Siek <jsiek_at_[hidden]>
http://www.osl.iu.edu/~jsiek
Ph.D. Student, Indiana University Bloomington
Graduating in August 2004 and looking for work
C++ Booster (http://www.boost.org)
_______________________________________________


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