Six Degrees of Separation
Introduction
Six degrees of separation is a concept that hypothesizes that any two people in the world are connected together with no more than six number of intermediate connections in between. Inspired by this concept, I was motivated to implement its algorithm and apply it to a small portion of the IMDb database that contains sufficient information about movies and their cast.
Implementation
We are interested in finding the shortest path between two actors by selecting a sequence of movies that connects them. This can be formulated as a search problem to be solved using the breadth-first search algorithm. Therefore, actors are considered as states, and movies serve as the actions that lead us from one state to another in this search strategy.
Final result
I tried to find out about the degree of separation between the following actors:
- Mandy Patinkin & Gerald R. Molen
- Jack Nicholson & Cary Elwes
- Robin Wright & Demi Moore
Reference for the stub code