在此图表任务中,最小化道路成本的算法
来完成这项任务
最近,我根据双向道路的系统 ,确定值得在哪个城市之间建造道路,以便在不到n公里以下的任何城市到其他任何城市。合格道路的距离和建筑成本分别指定。最小化道路建设成本。
我从两个矩阵中制作了Java图,以可视化初始合格的道路,但无法提出算法,我并不真正熟悉图形)
Recently I get this task
Based on the system of two-way roads, determine between which cities it is worth building roads so that one can get from any city to any other in less than N km. The distances and construction costs of eligible roads are specified separately. Minimize road construction costs.
I made java graph from two matrix for visualize initial eligible roads, but can't come up with algorithm, I'm not really familiar with graphs)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,Dijkstra的许多实现都将使Minumim从源到每个可能的目的地的距离。这可以用于优化计算M的循环
Note that many implementations of Dijkstra will give the minumim distance from a source to every possible destination. This can be used to optimize the loop calculating M