简体   繁体   English

路径的最短组合,以单个节点开始和结束,并覆盖无向图中的所有点

[英]The shortest combination of paths that starts and ends with a single node and covers all points in an undirected graph

I need an algorithm(k, s) where 我需要一个algorithm(k, s)其中

  • k is the number of paths k是路径数
  • s is the starting and ending node s是起点和终点

and given n number of nodes in an undirected graph in which all nodes are linked to each other, returns k paths to traverse all nodes of which the sum of distances covered by the k paths is the shortest. 在给定n个节点的无向​​图中,其中所有节点都相互链接,则返回k条路径以遍历所有节点,这些节点的k路径所覆盖的距离之和最短。

Eg Given n = 10 , algorithm(2,5) might give me an array of two arrays such that the sum of the distances covered by the two paths are the shortest and that all nodes are traversed. 例如,给定n = 10algorithm(2,5)可能会给我一个包含两个数组的数组,以使两条路径所覆盖的距离之和最短,并且遍历所有节点。

[[5,1,2,3,10,5],[5,4,6,7,8,9,5]]

Djikstra's algorithm finds the shortest path from one node to another, but not the shortest combination of k paths. Djikstra的算法找到从一个节点到另一节点的最短路径,但找不到k路径的最短组合。

Yen's algorithm finds k number of shortest paths from one node to another, but not the shortest combination of k paths. 日元的算法找到k数目的从一个节点到另一个的最短路径,但不是最短的组合k路径。

What algorithm can help me find the shortest combination of k paths that starts and end with node s such that all n nodes are covered? 哪种算法可以帮助我找到以节点s开始和结束以覆盖所有n节点的k条路径的最短组合?

What you are describing above, is the classical Traveling Sales Man problem, many optimization techniques. 上面描述的是经典的旅行商问题,还有许多优化技术。 One such is Ant Colony Optimization . 一种就是蚁群优化

There are many libraries that implement ACO, you could find one for Ruby, as it stands, there are no easy solutions to Traveling Salesman Problem with classical (mathematical) approach. 有许多实现ACO的库,就目前而言,您可以找到一个针对Ruby的库,没有经典(数学)方法解决Traveling Salesman问题的简单解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在有向图中有效查找2个节点之间的所有路径-RGL Gem - Efficiently Finding all paths between 2 nodes in a directed graph - RGL Gem Ruby - 从给定起点查找通过图形的所有路径 - Ruby - finding all paths through a graph from a given starting point 如何在Ruby on Rails中实现无向图? - How to implement undirected graph in Ruby on Rails? 在 BFS 中重建图中的最短路径 - Reconstructing the shortest path in a graph in BFS 匹配单词的正则表达式,但不是以连字符或冒号开头或结尾 - Regex for matching word but not if it starts or ends with hyphen or colon 如何搜索单个节点,而不是所有节点 - How to search a single node, not all nodes 计算图中从任何给定顶点到另一个顶点的所有可能路径的正确算法是什么? - What's a proper algorithm to count all possible paths from any given vertex to another in a graph? 如果行匹配或以尖括号开头和结尾,则正则表达式匹配 - regex match if line matches or starts and ends with angle brackets 将DFS(深度优先搜索)算法应用于邻接矩阵是否是列出图的所有根到叶路径的理想解决方案? - Is DFS (Depth-first search) algorithm applied on an adjacency matrix the ideal solution to list all root-to-leaf paths of a graph? 在sinatra中通往单条路线的多条路径 - Multiple paths to a single route in sinatra
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM