# [pgrouting-users] Working with the functions SHORTEST_PATH

pvela at uci.cu pvela at uci.cu
Wed Mar 25 19:50:31 EDT 2009

```
Hello colleagues
I am working with the functions SHORTEST_PATH and
SHORTEST_PATH_SOOTING_STAR, both are very potent for the work with
guided grapho and the definition of restrictions to the circulation.

Nevertheless, I am presenting problems with both functions,
The following figure, I will use it to illustrate the concrete
situation of the case of study that I develop.
By way of explanation:
1-Red arches, represent roads of double circulation
2-Blue arches, represent roads of one way
3-The arrows in each arch represent the sense of the digitalization
4-The numbers, red, represent the ID of the arch
5-The circles and numbers, green, represent the vertexes or nodes.

Note: Figure enclose

I have created the necessary structure of fields, such as: gid  as
ID, source, target, cost, reverse_cost, x1, y1, x2, y2, rule and
to_cost.

For the arches of double circulation: cost and reverse_cost = longitude arch
For those of a single sense: cost = longitude arch and and
reverse_cost = longitude arch + 100000.

After these elements to put in context the investigation problem, I
passed to their concrete explanation.

In the case of:
SHORTEST_PATH_SOOTING_STAR--- which works with the you GO of the
Arches of Exit and Destination, I don't achieve that the function
analyzes an arch of double sense (when this it is: source) in sense
contrary to their layout (that is to say, of the final vertex to the
initial vertex). Always part the beginning analysis to final and
starting from there, it builds the road. For example (to see the
figure) if I want to go of the Arch 2 at the 1, the solution that I
obtain is: 2,5,8,4,3,1 and not 2,1 like it should really be.

In the case of:
SHORTEST_PATH and also with SHORTEST_PATH_SOOTING_STAR--- it happens
me something that has me confused, and I don't know how to solve,
although it already identifies their manifestation.  For example, when
the function analyzes an arch that is connected to other two, in
common through a vertex, and each one of these it is of a circulation
sense (to see figure; example: 4, 8 and 9), in the resulting solution
I obtain the first arch that the algorithm resourceful analyzes, this
is in function of the ordination approach applied to the consultation
to the chart of arches. He/she always leaves with the first arch that
finds, not respecting in approach of inverse cost, which is up to a
million units of measure superior.

I hope to be able to transmit them clearly the problem that I confront
with these functions and that if some of you, has faced something
similar I can throw a hand with this.

Greetings to all, and I look forward to their answer

Paul

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Grapho.PNG
Type: image/x-png
Size: 3438 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20090325/c8a725f3/Grapho.bin
```