0

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. Number of vertices is more than 100k. Maybe it will take more than a week... Actually I don't need all of the paths. I only need the longest one.

1 Answers1

0

You might want to implement the all-pair-shortest-path variant of 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.

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

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.

SpaceTrucker
  • 13,377
  • 6
  • 60
  • 99