Least cost path with multiple points

后端 未结 2 2029
再見小時候
再見小時候 2021-02-10 19:20

I am trying to connect bivariate location points together to form a route. My points refer to fish locations, and so I need paths that only pass through water, and not the surro

2条回答
  •  悲哀的现实
    2021-02-10 19:38

    You could use a minimum spanning tree, where the cost on each edge is a function of distance and other factors. In your case, set the weight to infinity if an edge crosses non-water, making sure it never gets used unless they are required at the end to connect the graph. If the graph is non-connected, you can run two or more minimum spanning trees on each disconnected group of points. See wikipedia for easily implemented algorithms, notably Prim's algorithm.

提交回复
热议问题