好的,所以基本上我的程序中有 2 个多维数组:
生成的距离:空
999.0 22.0 38.0 9.0 12.0
10.0 999.0 9.0 22.0 24.0
10.0 41.0 999.0 25.0 49.0
4.0 2.0 18.0 999.0 1.0
4.0 38.0 8.0 20.0 999.0
道路矩阵:
null town town national regional
town null national motorway motorway
town motorway null regional town
motorway national national null town
town town national regional null
第一个数组生成距离,而第二个数组生成这些距离的道路类型。
我正在使用一种算法来计算最佳路线,我正在处理第一个矩阵。我使用了一个数组列表。
[0, 4, 3, 1, 2, 0]
基本上我想在我的第二个数组中获取道路索引。
结果应如下所示[区域,区域,国家,国家,城镇]
我只是想知道使用第一个矩阵生成的结果最有效的方法是什么?
谢谢