Reachability and shortest paths are among two of the most common queries realized on graphs. While graph frameworks and property graph databases provide an extensive and convenient built-in support for these operations, it is still both clunky and inefficient to perform on standard SQL DBMSs. In this paper, we present an extension to the standard SQL language to compute both reachability predicates and many-to-many shortest path queries. We first describe a methodology to represent a directed graph starting from virtual table expressions. Second, we introduce a new type of operator to compute shortest paths on the given graph. Our semantic abides by the rules of operating with table expressions, ensuring that the property of the closure from the relational algebra is retained. Finally, we developed a prototype implementation of our extension on top of MonetDB, an existing open source relational DBMS. Our preliminary results still show that dynamically building our representation of the underlying graph overly dominates the query time. Currently, this cost can only be amortized when executing multiple shortest paths on the same graph.

Additional Metadata
Persistent URL dx.doi.org/10.1145/3078447.3078457
Conference Graph Data Management: Experiences and Systems
Citation
de Leo, D, & Boncz, P.A. (2017). Extending SQL for computing shortest paths. In Proceedings of the International Workshop on Graph Data-management Experiences & Systems. doi:10.1145/3078447.3078457