The shortest_path function has the following declaration:
CREATE OR REPLACE FUNCTION shortest_path(
sql text,
source_id integer,
target_id integer,
directed boolean,
has_reverse_cost boolean)
RETURNS SETOF path_result
sql: a SQL query, which should return a set of rows with the following columns:
SELECT id, source, target, cost FROM edge_table
source_id: int4 id of the start point
directed: true if the graph is directed
has_reverse_cost: if true, the reverse_cost column of the SQL generated set of rows will be used for the cost of the traversal of the edge in the opposite direction.
The function returns a set of rows. There is one row for each crossed edge, and an additional one containing the terminal vertex. The columns of each row are:
SELECT * FROM shortest_path('SELECT gid AS id, source::int4,
target::int4, length::double precision AS cost,
FROM dourol',3, 7, false, false);
vertex_id | edge_id | cost
-----------+---------+------------------------
3 | 2 | 0.000763954363701041
4 | 21 | 0.00150254971056274
6 | 5 | 0.000417442425988342
7 | -1 | 0
(4 rows)
SELECT * FROM shortest_path('SELECT gid AS id, source::int4,
target::int4, length::double precision AS cost,length::double precision
AS reverse_cost FROM dourol', 3, 7, true, true);