[Lemon-user] output from suurballe.path(i)
Kovács Péter
kpeter at inf.elte.hu
Thu Nov 19 10:59:30 CET 2009
Dear Jan Willem,
I attached a simple example code. It constructs a small digraph, runs Suurballe
on it and prints out the found paths. I hope it will help you.
> I am trying to run suurballe_test.cc from the test directory. I can
> compile the following sequence:
> suurballe.run(s,t,2);
> suurballe.path(1);
> The problem is that this produces no output
The test programs are intented to check the functionalities of the library, they
do not produce output unless something went wrong.
> If I instead do:
> suurballe.run(s,t,2);
> std::cout << suurballe.path(1) << std::endl;
> I get a rather large list of compile errors
This is just because a path structure cannot be written to the standard output
directly. There is no operator<<() function for them.
Paths are lists of arcs. These arcs can be iterated using the ArcIt type or the
nth() function of the path structure. The ID of an arc or the IDs of its source
and target nodes can be printed (e.g. g.id(a), g.id(g.source(a)) etc.).
> I believe it is something to do with the data type of suurballe.path(),
> so I am trying to assign a variable routestring:
> typedef const SimplePath <ListDigraph> routestring;
Note that routestring is a type here!
> suurballe.run(s,t,2);
> routestring = suurballe.path(1);
Therefore, you must write something like that:
routestring route = suurballe.path(1);
However, it won't solve the problem of printing. You have to traverse the arcs
of the path, see the example code.
Regards,
Peter
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: suurballe_example.cpp
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20091119/095a150b/attachment.ksh>
More information about the Lemon-user
mailing list