by evgskv · 2y ago · 0 comments
D(a, b) Min= 1 :- G(a, b); # Connected by an edge => distance 1.
D(a, c) Min= D(a, b) + D(b, c); # Triangle inequality.
It will be much harder to read with SQL CTE.
It can also computed over weighted graphs, which is impossible or extremely hard with SQL.In practice you rarely need recursive querries, so gap between Logica and SQL isn't as large as it is here, but Logica is easier to read (in my opinion) for similar reasons.
No comments yet.