I have a NODE table and an EDGE table which defines the nodes and edges connecting them, respectively. I'd like to find the shortest path from A to B.

It's straightforward to implement Dijkstra's algorithm (the shortest path from A to B algorithm) in SQL using repeated selects. But this probably going to be incredibly slow. Putting it in a stored procedure probably won't help very much.

Does someone have an idea on how to obtain the shortest path in a more efficient manner?

    5 months later

    Hi,
    So how is Dijkstra's algorithm implemented using SQL? Can someone tell me? Because I was thinking about doing it in Java, but if SQL is easier, then I would like to do it that way....

    many Thanks,
    Katie

      10 months later

      Tambien yo estoy interesado en un algoritmo de Dijkstra implementado en sql o en PL SQL o bien en SQL*Plus. Lo necesito para un proyecto que estoy realizando.Gracias

      Scott Marlowe wrote:

      There's a discussion about using postgresql's built in distance functions and stuff to read the tigerline data to do just that one:

      http://lists.perens.com/pipermail/map/2000-November/000007.html

        2 years later

        the links above seem as dead as a doornail. did anyone ever get anywhere with this? please email me if you did...

          Write a Reply...