Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-24 07:55:49


Are you ever adding vertices? AFAIK the library won't add vertices
implicitly; you have to make them before creating the edges which are
incident on them.

-Dave

----- Original Message -----
From: "lucatoldo" <luca.toldo_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, January 24, 2002 5:06 AM
Subject: [BGL] BFS and copy problem (was Re: [boost] Compilation)

> I think there is something I do not know, rather important, about the
> process of adding edges to the graph object. Infact, even in the
> simple example/bfs.cpp if I swap the start with the ends, I get
> different results. Namely:
>
> If I change the code from this
>
> boost::add_edge(0,2,G);
> boost::add_edge(1,1,G);
> boost::add_edge(3,1,G);
> ...
> boost::add_edge(4,1,G);
>
> to
>
> boost::add_edge(2,0,G);
> boost::add_edge(1,1,G);
> boost::add_edge(1,3,G);
> ...
> boost::add_edge(1,4,G);
>
> then I get
>
> the graph OK but the distances and the parent vectors are screwed:
>
> I get
>
> distances: 0 2 2 2 1
> instead of
> distances: 0 2 1 2 2
>
> and
>
> parent[0] = 0
> parent[1] = 4
> parent[2] = 4
> parent[3] = 4
> parent[4] = 0
>
> instead of
>
> parent[0] = 0
> parent[1] = 2
> parent[2] = 0
> parent[3] = 2
> parent[4] = 2
>
> I feel I am missing some basic knowledge on how to appropriately use
> this powerful and amazingly fast system. I would love to learn the
> missing bit.
>
> Looking forward your advice and sorry again for the dumminess of this
> question.
>
>
> Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk