This is the second of a two-part blog series. Because a hierarchy is the most restrictive kind of graph, [Part One]  used a simple representation and a simple traversal method. The Bacon Numbers problem is based on the most general kind of graph—an undirected cyclic graph . Part Two therefore uses the general graph representation and the general traversal method.

[Using a recursive CTE to compute Bacon Numbers for actors listed in the IMDb]
All the code snippets and pictures in this post are copied from the YSQL documentation. The main page of the overall [WITH] [** clause and common table expressions**] section explains that all the code is available in a downloadable code zip with a few master scripts to run all of the code mechanically.

#postgresql #recursive #cte #imdb #bacon numbers

Using the PostgreSQL Recursive CTE – Part Two
1.15 GEEK