项目作者: duanshuai007

项目描述 :
基于geo地图的最短路径算法
高级语言: JavaScript
项目地址: git://github.com/duanshuai007/dijkstras.git
创建时间: 2020-12-07T02:14:25Z
项目社区:https://github.com/duanshuai007/dijkstras

开源协议:

下载


dijkstras-js

Javascript implementation of Dijkstra’s algorithm

Sample Usage

  1. var map_array = [
  2. [[199,39],[200,40]],
  3. [[200,40],[201,40]],
  4. [[201,40],[202,40]],
  5. [[202,40],[202.7,39.8]],
  6. [[202.7,39.8],[202.4,39.4]],
  7. [[202.4,39.4],[201.8,39.2]],
  8. [[201.8,39.2],[201,39.2]],
  9. [[201,39.2],[200,39.1]],
  10. [[200,39.1],[199,39]],
  11. [[199,39],[200,38.8]],
  12. [[200,38.8],[201,39.2]],
  13. [[199,39],[200.5,39.6]],
  14. [[200,39.1],[200.5,39.6]],
  15. [[200.5,39.6],[200,40]],
  16. [[202,40],[201.8,39.2]],
  17. [[200.5,39.6],[201,39.2]],
  18. [[201,39.2],[202,40]],
  19. [[202,40],[202.4,39.4]]
  20. ]
  21. var d = new Dijkstras();
  22. d.setGraph(map_array);
  23. var path = d.getPath([199,39].toString(), [202.7,39.8].toString());
  24. console.log(path);

Resources

http://en.wikipedia.org/wiki/Dijkstra's_algorithm

Fork!

Please fork and improve!