Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetching all the paths between two nodes using SQL Server Graph 2017

I found many examples of fetching paths between 2 nodes in neo4j and gremlin but could not find any on SQL Server Graph 2017. Though it uses Cypher's Match, I was thinking if it is possible to find the path using only Match?

Thanks in advance!

like image 275
fdabhi Avatar asked Sep 12 '26 15:09

fdabhi


1 Answers

Since SQL Server 2019 you can use SHORTEST_PATH algorithm. It doesn't allow you to list all paths though, only the shortest one, hence the name.

You can either create your own CLR function to do that, use WHILE cycle to traverse the graph step by step or download the whole graph and traverse it using C#.

like image 96
andowero Avatar answered Sep 14 '26 04:09

andowero



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!