Hi-

I wrote the code you posted, but it's not clear to me what you're trying to
do differently. The path that's found is indeed the shortest path of the
three.

I can think of a few other things you may be trying:

1) Find the shortest combination of paths between all the points. 

If this is what you want to do, for this simple scenario, do the following:
make the code dependant upon the path passing through the point of origin,
then once you find the first short segment, switch the origin point to the
new endpoint. Keep in mind that this is not a scalable solution, since it
can be wrong (if the sum total of all the paths is not represented by the
shortness of the first path), and it's a brute-force approach. You're better
off starting from scratch. See the shortest-path link below.

2) Find the shortest path between any two points, origin unspecified.

In this case, this code doesn't really need to be adapted, except to make
sure that shortest path does indeed pass through 2 target points.

3) Find the shortest distance between any two points, origin specified, but
with no paths elements joining them.

For this, you might take a look at another bit of code I wrote, to help
navigate around a document [1].


You say that you want to use the Dijkstra Algorithm, but are you sure that's
what you want, or are you merely going on the fact that it has been
mentioned on this list? You might be interested to know that there are many
different shortest-path solutions, depending on exactly what you're trying
to do [2]. On this link, they talk about 'nodes' and 'edges'; in this case,
a 'node' is the point of intersection (the dot, the city, whatever), and an
'edge' is the path that joins 2 nodes.

[1] http://svg-whiz.com/BAM/focusNavigation.svg
[2] http://en.wikipedia.org/wiki/Shortest_path_problem

Regards-
Doug

doug . schepers  @ vectoreal.com
www.vectoreal.com ...for scalable solutions.
 

e2mieluv wrote:
| 
| Below is a program I get from pathLength which calculates the 
| shortest-path.However,i'm having trouble including dijkstra 
| in the javscript.anyone could help me with it? currently it 
| could identify shortest-path out of the 3 path.not the whole point. 
| 
<snip />



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to