以矩阵最短路径矩阵、最短、路径

由网友(蜜糖)分享简介:我有点糊涂了,我有以下模式I am a bit confused, i have following patternS...*.......*.....**...**..G1....*............G2**..............*.G3D传说的含义如下:meaning of lege...

我有点糊涂了,我有以下模式

I am a bit confused, i have following pattern

S...*...
....*.....
**...**.
.G1....*.
........
...G2**..
........
....*.G3D

传说的含义如下:

meaning of legends are as follows

S = source 
D = Destination 
G = point to be visited before reaching destination
. = paths 
* = blocked path

请问这种做法给我的最短路径?

Will this approach give me the shortest path?

Distance = Min((S,G1) (S,G2) (S,G3))  
Distance = Distance + Min((G1,G2) (G1,G3))  // Assuming that G1 is shortest  
Distance = Distance + Distance(G3 , D)

阅读全文

相关推荐

最新文章