Storing Routes and Locations in Graph using SQL Server 2017
SQL Server's graph capabilities are -- how can I put this nicely -- limited. At the moment it is really just a little syntactic sugar in the new MATCH clause. There is no support for any serious graph-oriented algorithm.  To achieve your goals you will end up using recursive CTEs, which do not play nicely with MATCH. While a solution is possible it will not be elegant. Sorry to be the bearer of bad news.

To learn about graph design &amp; algorithms I would suggest starting with a specific graph DBMS. Neo4j springs to mind. Otherwise you will be spending all your time in work-arounds and never see the big picture.