What do Leonard Nimoy, Stana Katic, and Robert Downey Jr. have in common? They all have a Bacon number of 2. The Six Degrees of Kevin Bacon, a game created early in 1994 by three Albright College students, is a classic problem in graph theory. The object of the game is to find the shortest path between a given actor and Kevin Bacon, where an intermediary connection can only be made between actors who have appeared together in a movie. For example, Stana Katic was in *Stiletto* with Kelly Hu, who was in *The Air I Breathe *with Kevin Bacon. While there is only one person with Bacon number 0 (Kevin Bacon himself), most individuals involved in the Hollywood film industry have a Bacon number of 6 or less. As of April 28, 2013, the Oracle of Bacon computed that of the actors listed on the Internet Movie Database, only 329 out of 1,605,485 have a Bacon number of 7 or higher:

Bacon Number | # of people |
---|---|

0 | 1 |

1 | 2769 |

2 | 305215 |

3 | 1021901 |

4 | 253177 |

5 | 20060 |

6 | 2033 |

7 | 297 |

8 | 25 |

9 | 7 |

In fact, using this table, we find that the average Bacon number is 2.994.

But why use Kevin Bacon as the “center” of the Hollywood universe? It all started when three college friends, Brian Turtle, Mike Ginelli, and Craig Fass, were snowed in one night watching movies on TV. *Footloose* was followed by *Quicksilver*, with a commercial for a third Kevin Bacon movie coming on between the other two. This impromptu Kevin Bacon marathon caused the three friends to remark on the multitude of movies which included Bacon. It seemed like he was in everything! This prompted the question: Had Bacon ever worked with Robert De Niro? This was before the movie *Sleepers* had been released, so the answer was no. However, De Niro was in *The Untouchables* with Kevin Costner, who was in *JFK* with Bacon. And so the game Six Degrees of Kevin Bacon was born.

Turtle, Ginelli, and Fass wrote a letter to Jon Stewart, explaining the game and how “Kevin Bacon was the center of the entertainment universe.” In the months that followed, they appeared on *The Jon Stewart Show* and *The Howard Stern Show* to explain the game and eventually released a book, *Six Degrees of Kevin Bacon*. Today, the game is well-known, both for being a fun game to play with friends, as well as a classic homework problem in many computer science classes.

The Six Degrees of Kevin Bacon game is actually a problem in graph theory. Every actor is assigned to a vertex, and an edge is added between two actors if they have appeared together in a movie. Then, the problem of connecting a given actor to Kevin Bacon in the fewest number of steps becomes a traditional graph theory problem – finding the shortest path between two vertices. There are many shortest path algorithms that could be applied to this problem. For example, Dijkstra’s algorithm, which solves the positive-weighted shortest-path problem, could be used. After running Dijkstra’s algorithm, we would have the path with lowest cost (i.e. the shortest path) between a given source vertex (the vertex corresponding to Kevin Bacon for our application) and all other vertices. However, using Dijkstra’s algorithm in this context is excessive. Dijkstra’s algorithm is best suited for situations where each edge has an associated nonnegative length/weight and the goal is to find the path that minimizes the total length. For the Six Degrees of Kevin Bacon game, we are only concerned with finding the shortest path in terms of the number of connecting movies (edges) used, so each edge can be thought of as having weight 1. Thus, we would like to use the breadth-first search algorithm, which will solve the problem and be more time efficient than Dijkstra’s algorithm.

The breadth-first search (BFS) algorithm operates by processing vertices in layers: Those closest to the source vertex are evaluated first, and those most distant are evaluated last. The algorithm uses a “roving eyeball” approach, where the eyeball moves from vertex to vertex, starting at the source (Kevin Bacon). Associated with each vertex is a number , which is the cost of getting from the source vertex to vertex . In our application, the cost after running the BFS algorithm is the Bacon number of the actor associated with vertex . If is the source vertex, we initialize the costs with and for all . The algorithm proceeds as follows, with the eyeball starting at the source vertex:

1. If is the vertex that the eyeball is currently on, then, for all that are adjacent to , we set if .

2. Move the eyeball to another vertex (which has not already been visited by the eyeball) such that . If that is not possible, we move to a that satisfies . If that is not possible, we are done.

The algorithm uses a queue data structure to store intermediate results as the eyeball moves around the graph. When a vertex has its distance lowered (which can only happen once), it is placed in the queue so that the eyeball can visit it in the future. The source vertex is placed in the queue when its distance is initialized to zero.

In the BFS algorithm, there is nothing special about the vertex associated with Kevin Bacon, other than the fact that it is designated as the source vertex and so is where the eyeball starts. We could have just as easily started with a different actor, which would give us a new “center” of the Hollywood universe. But can we do better than Kevin Bacon? According to the Oracle of Bacon, the answer is yes! By comparing the average personality numbers (e.g. for Kevin Bacon we would use the weighted average of all “Bacon Numbers” while for Sean Connery we would use the weighted average of all “Connery Numbers”), actors can be ranked. As of April 28, 2013, Kevin Bacon is the 370^{th} best center, where actors are compared based on their average number. Can you guess who is the best “center” of the Hollywood universe? Head on over the the list of 1000 best centers and find out!

Sources:

- Fass, Craig, Brian Turtle, and Mike Ginelli (1996).
*Six Degrees of Kevin Bacon*. New York City: Plume. - Weiss, Mark Allen (2000).
*Data Structures and Problem Solving Using C++, Second Edition*. Reading, Massachusetts: Addison Wesley Longman. - The Oracle of Bacon: http://oracleofbacon.org/
- NPR Interview: http://www.npr.org/2012/09/14/161130024/the-history-of-six-degrees-of-kevin-bacon

Nice Article

This was a very informative article.