[英]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.