CMSC 132A Lecture Notes - Lecture 27: Delimiter, Six Degrees Of Kevin Bacon, Ed Asner
CMSC132A Lecture 27: Six Degrees of Kevin Bacon fun
Last time we created a book class but we didn’t exactly finish the method called
isConnected() which tells us which books are connected to which authors. In a way, it is
related to the “Six Degrees of Kevin Bacon” parlor game which goes like this:
The Bacon number of an actor or actress is the number of degrees of separation he or
she has from Bacon, as defined by the game. This is an application of the Erdős
number concept to the Hollywood movie industry. The higher the Bacon number, the
farther away from Kevin Bacon the actor is.
The computation of a Bacon number for actor X is a "shortest path" algorithm, applied to
the co-stardom network:
● Kevin Bacon himself has a Bacon number of 0.
● Those actors who have worked directly with Kevin Bacon have a Bacon number
of 1.
● If the lowest Bacon number of any actor with whom X has appeared in any movie
is N, X's Bacon number is N+1.
Take for example Elvis Presley
● Elvis was in Change of Habit (1969)
with Edward Asner
● Edward Asner was in JFK (1991)
with Kevin Bacon
Therefore Edward Asner has a Bacon number of 1 and Elvis Presley has a Bacon
number of 2.
How does this have anything to do with our library class? Well, we are essentially
finding a path to any given author based on the collaboration that author had with other
authors. Remember this code?
Boolean isConnected(AuthorN a){
If (this.equals(a)){
Return true;
}
Else{