find out the shortest route
610373Mar 27 2008 — edited Apr 1 2008Hi
I have two tables, nodes and links and the structure of the tables are
sql> select * from node;
node_id node_name node_type
--------- ----------- ----------
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
and so.........
sql> select * from link;
link_id start_node end_node distance
-------- ----------- --------- ---------
L1 9001 9002 50
L2 9002 9005 350
L3 9001 9003 80
L4 9003 9008 150
L5 9008 9005 253
L6 9005 9004 174
L7 9006 9009 186
L8 9010 9009 40
L9 9003 9010 1520
L10 9002 9006 520
L11 9004 9009 610
and so on.......
and the columns in the link table start and end nodes are referenced from the node_id of the node table and the condition is
the links are not directed(i.e, the link should be existed from 9001-9002 and also 9002-9001)
Now i want the possible route combinations from one node to another based on distances of the links(i.e, need to find the shortest path)
for example
i want the possible comb's from 9001 to 9010
o/p should be like this
result distance
----------------------------------------- ---------
9001-9002-9005-9008-9003-9010 2323
9001-9002-9006-9009-9010 610
9001-9003-9008-9005-9002-9006-9009-9010 1579
9001-9003-9008-9005-9004-9009-9010 1307
9001-9003-9010 1600
9001-9002-9005-9004-9009-9010 1224
Ant Help?
Thank you