Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-01-23 13:45:25


On Wed, 23 Jan 2002, lucatoldo wrote:
luca.t> Dear All,
luca.t> I am a newbie of the boost system as well as of C++ and therefore
luca.t> please tolerate by question.

Of course, we welcome questions about the boost libraries.

luca.t> I have an large tree (35798 nodes, 63947 edges) of which I would like
luca.t> compute the minimum distance between few hundreds of pairs of nodes.
luca.t> While in the current implementation the edges are all of length "1",
luca.t> in a "next step" I would like to also add some weights.
luca.t> I have installed the boost system (and purchased the book) yesterday
luca.t> on a Linux without any problem. I am now familiar with the jam
luca.t> building system and works fine.
luca.t> I then converted my graph into a file like the following:
luca.t> n 35798
luca.t> e 19 1
luca.t> e 20 19
luca.t> e 21 20
luca.t> ...
luca.t> and have tried to modify bfs.c in order to read it in but failed.

Why did it fail? Perhaps you could post the code so I can try see why.

luca.t> I then converted the graph into a series of
luca.t> boost::add_edge(19,1,G)
luca.t> boost::add_edge(20,19,G)
luca.t> boost::add_edge(21,20,G)
luca.t> then modified the bfs.cpp code appropriately (it is now and compiled
luca.t> it, without any problem.
luca.t> The example/bfs.cpp compiled without problems also in the distributed
luca.t> version, and delivered result which was ok.
luca.t> On the hardware I am using for these experiments
luca.t> (
luca.t> 300 MHz Pentium PII, 130 MB RAM, Linux Kernel 2.2.18
luca.t> 900 MHz 4 processor Pentium PIII, 1 GB RAM, Linux Kernel 2.4.3
luca.t> )
luca.t> it takes considerable amount of time to compile but then is
luca.t> incredibly fast in delivering the result.

Great! That's one nice thing about C++ and template libraries :)

luca.t> Unfortunatley, however, I am getting some strange results with my
luca.t> data. Namely, the first part of the output is allright
luca.t> 19 --> 1
luca.t> 20 --> 19
luca.t> 21 --> 20
luca.t> ...
luca.t> 35797 --> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 35791
luca.t> however the second one (I guess it is G_copy) it only contains the
luca.t> start nodes
luca.t> 0 -->
luca.t> 1 -->
luca.t> Furthermore the distances are all set to 0 (zero)
luca.t> And the parent[0] are as well set to 0 (zero)
luca.t> Any advice is welcome.

If you post the code I could try to help you solve the problem.


 Jeremy Siek
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster ( office phone: (812) 855-3608

Boost list run by bdawes at, gregod at, cpdaniel at, john at