Adventure is SQL and Graph Theory (part 1)

my favorite topic is OpenStreetMap + SQL
And the “street networks” are the most common use case for “graphs” ( ~ routing )

in the PGRouting ( “pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.” ) the pgr_dijkstra() functions, has an interesting first parameter - “Edges SQL” as a String …
selecting fixed data from the table (id, source, target, cost)

SELECT * FROM pgr_dijkstra(
    '
      SELECT gid AS id,
        source,
        target,
        length AS cost
      FROM ways
    ',
    279,  
    16826,
    directed := false);

My dream: IF the PL/Julia - will be more matured,
we can re-implement the pgRouting functions
in Pl/Julia +LightGraphs.jl/src/shortestpaths/dijkstra.jl

If you have any ideas

If you need data - for your research; my suggestions:

  • Wikidata ( as a graph database, there is a free dump )
  • OpenStreetMap

in the PostgreSQL word … there are a lot of interesting extensions/projects

1 Like