Get the latest tech news

Degrees of Kevin Bacon Using Postgres


Paul Ramsey has some great examples of Postgres network analysis and graph theory in this sample code for playing the Kevin Bacon game. Both pgRouting and recursive CTE are used to solve graphing relationships.

Back in the 1990s, before anything was cool (or so my children tell me) and at the dawn of the Age of the Meme, a couple of college students invented a game they called the " Six Degrees of Kevin Bacon". In our modern age we don't need to be smart, we can attack the Bacon Number problem by combining data and algorithms. The IMDB database files actually include information about every job on a film (writers, directors, producers, casting, etc, etc) and we are only interested in actors for the Kevin Bacon game.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of degrees

degrees

Photo of Postgres

Postgres

Photo of Kevin

Kevin

Related news:

News photo

Postgres as a Search Engine

News photo

Roadside Tesla Semi fire where temperatures reached 1,000 degrees draws in NTSB investigative team

News photo

Postgres feature you're not using – CTEs a.k.a. WITH clauses