Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-01-24 09:20:14


Again, Luca, we can't help you unless you post the code (the complete C++
file). I can't just guess what is going wrong. You're probably forgetting
to do something, and there's no way I can tell what that is based on what
you've written below.

On Thu, 24 Jan 2002, lucatoldo wrote:

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

----------------------------------------------------------------------
 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