Some very useful and important graph-specific functions and methods are not supported in SQL Server 2017's SQL Graph:
- Transitive closure
- Shortest path between two nodes
- Polymorphism
- PageRank
A feature called transitive closure, usually present in graph databases, is not available in the SQL Graph feature of SQL Server 2017, an extension or superset of a binary relation so that whenever (a,b) and (b,c) are in the extension, (a,c) is also in the extension. This is a very useful feature that gives you all paths between two nodes or answers questions such as May I fly from Linz (Austria) to Stavanger (Norway)? or How can I reach Liverpool from Belgrade? Unfortunately, SQL Graph's MATCH clause does not support transitive closure and you need to use Transact-SQL solutions that include loops, cursors, or (inefficient) recursive common table expressions.
A special case of transitive closure is the shortest path functionality, which is used to find the shortest path between two nodes. This is a common requirement in most of the graph database solutions, but is missing in the SQL Graph.
MATCH (c1:City {name: "Belgrade"}), (c2:City {name: "Liverpool"}), path = shortestpath((c1)-[:FLIGHT*]->(c2))
RETURN path
Polymorphism is the ability to find all nodes connected to a given node. Since SQL Graph does not support polymorphism, Microsoft recommends writing recursive queries with the UNION clause over a known set of node and edge types. However, this solution does not scale and can only be used for a small set of nodes.
PageRank gives us a measure of the importance of a node within a graph structure. It analyzes nodes that are in relation to a single node and calculates their importance or popularity. This is a complex algorithm, but answers simple questions such a What is the most searched page? or Who are the most influential Twitter users?
There are huge limitations in graph capabilities in SQL Server 2017, and without them, I cannot imagine a significant use of the SQL Graph feature in serious projects.