简体   繁体   English

在非常大规模的加权和有向图中获得所有对最短路径的最佳方法是什么?

[英]what is the best way to get all pair shortest path in very large scale weighted and directed graph?

I'm trying to find all pair shortest path in very large scale graph.我试图在非常大的比例图中找到所有对的最短路径。 I tried floyd-warshall but it is not fast enough because of very large scale of the graph.我试过 floyd-warshall 但它不够快,因为图表的规模非常大。 Number of vertices is more than 100k.顶点数超过 100k。 Maybe it will take more than a week... Actually I don't need all of the paths.也许需要一个多星期......实际上我不需要所有的路径。 I only need the longest one.我只需要最长的那个。

You might want to implement the all-pair-shortest-path variant of Hagerup .您可能想要实施Hagerup的全对最短路径变体。 The time bound of O(nm + n^2 log log n) might be much better than Floyd–Warshalls O(n^3) depending on how many edges your graphs have. O(nm + n^2 log log n)的时间界限可能比 Floyd–Warshalls O(n^3)好得多,这取决于你的图有多少条边。

You might also be able to set up Neo4j and use it to calculate that path: https://neo4j.com/docs/graph-data-science/current/alpha-algorithms/all-pairs-shortest-path/#algorithm-all-pairs-shortest-path-sample您也可以设置 Neo4j 并使用它来计算该路径: https://neo4j.com/docs/graph-data-science/current/alpha-algorithms/all-pairs-shortest-path/#algorithm-所有对最短路径样本

CALL gds.alpha.allShortestPaths.stream({
  nodeProjection: 'Loc',
  relationshipProjection: {
    ROAD: {
      type: 'ROAD',
      properties: 'cost'
    }
  },
  relationshipWeightProperty: 'cost'
})

I don't know that, but depending on the syntax you might be able to select only specific paths from the stream.我不知道,但根据语法,您可能只能从 stream 到 select 的特定路径。

暂无
暂无

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

相关问题 在有向加权图中找到从起点到所有终点的最短路径的最快方法 - Quickest way to find shortest paths from origin to all destinations in a directed weighted graph 如何使用 NetworkX 在加权图中获得最短路径? - How to get the shortest path in a weighted graph with NetworkX? 通过加权图的最短路径 - shortest path through weighted graph 在定向加权图中查找最短路径,该路径访问每个节点,对重新访问节点和边缘没有限制 - Find shortest path in directed, weighted graph that visits every node with no restrictions on revisiting nodes and edges 加权和有向 2D 熊猫 csv 图中从 A 到 B 的最短路径 - Shortest path from A to B in a weighted and directed 2D pandas csv graph 最短路径GENERATION,在定向和加权图中具有正好k个边(编辑:仅访问每个节点一次) - Shortest path GENERATION with exactly k edges in a directed and weighted graph (edit: visit each node only once) 在有向加权图中,有效地找到两个节点 A 和 B 之间穿过节点 X 的最短路径的成本 - In a directed, weighted graph, efficiently find the cost of the shortest path between two nodes A and B that traverses through a node X 加权循环有向图中的最长路径 - Longest path in weighted cycle directed graph 在 NetworkX 中找到加权图的最短路径长度 - Find the shortest path length of a weighted graph in NetworkX 使用加权顶点计算图中的最短路径 - Calculate shortest path in graph with weighted Vertices
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM