# Adventure is SQL and Graph Theory (part 1)

**URL:** <https://discourse.julialang.org/t/adventure-is-sql-and-graph-theory-part-1/59665>\
**Category:** New to Julia\
**Tags:** graphs\
**Created:** [April 20, 2021, 1:43pm UTC](https://discourse.julialang.org/t/adventure-is-sql-and-graph-theory-part-1/59665 "2021-04-20T13:43:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)\
**Post date:** [April 20, 2021, 3:29pm UTC](https://discourse.julialang.org/t/adventure-is-sql-and-graph-theory-part-1/59665/2 "2021-04-20T15:29:17Z")

</div>

> [@AlexanderChen](#):
>
> find a valid usecase to combine traditional SQL datawarehouse with a graph layer

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

in the [PGRouting](https://pgrouting.org/) ( _“pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.”_ ) the [pgr\_dijkstra()](https://docs.pgrouting.org/latest/en/pgr_dijkstra.html) functions, has an interesting first parameter - “ **Edges SQL** ” as a String …  
selecting fixed data from the table (id, source, target, cost)

```julia
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](https://discourse.julialang.org/t/gsoc-2021-postgresql-create-procedural-language-extension-for-the-julia-programming-language/56918) - will be more matured,  
we can re-implement the pgRouting functions  
in Pl/Julia +[LightGraphs.jl/src/shortestpaths/dijkstra.jl](https://github.com/JuliaGraphs/LightGraphs.jl/blob/master/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

- _“Apache AGE a PostgreSQL extension that provides graph database functionality.”_
  - [https://age.apache.org/](https://age.apache.org/) ( new project )

- “Apache MADlib: Big Data Machine Learning in SQL” (Greenplum, PostgreSQL)
  - [https://madlib.apache.org/](https://madlib.apache.org/)
    - [“Graph algorithms and measures associated with graphs.”](https://madlib.apache.org/docs/latest/group __grp__ graph.html)
      - shortes path, pagerank, HITS, …

---

_[View the full topic](https://discourse.julialang.org/t/adventure-is-sql-and-graph-theory-part-1/59665)._
