Due 9am, Monday, 25 April 2016
Please write or type up your solutions, and hand in a paper copy before class on Monday.
In class, we have been discussing how Graph structures might can be used to represent relationships between groups of objects. For this assignment, you will be writing a program that allows you to play the "Kevin Bacon Game". A person's "Bacon Number" is computed based on the number of movies of separation between that person and the actor Kevin Bacon. For example, if you are Kevin Bacon, then your Bacon Number is 0. If you were in a movie with Kevin Bacon, your number would be 1. If you weren't in a movie with Kevin Bacon, but were in a movie with someone who was, your Bacon Number would be 2. In short, your Bacon Number is one greater than the smallest Bacon Number of any of your co-stars.
Note that this is a take off of Erdos numbers (mine's 3), and the two can be combined to form the more elusive Erdos-Bacon number.
For fun and some additional background, you can try out the Oracle of Bacon at the University of Virginia.
In class we developed Dijkstra's algorithm for finding the shortest paths from a Start node to every other node in weighted graphs with non-negative weights. In that algorithm we stored a vertex, its tentative distance from the Start node, and its predecessor in a priority queue. The comparator for this queue considers only the distance field. The queue starts with the Start node at distance 0, with null predecessor. Until the priority queue is empty we do the following:
Run Dijkstra's algorithm on the following graph. At each step keep track of the members of the priority queue, the distance to each node, and the predecessor of each node.
CSLAM Studios (Computer Science Lab Assignment Movies) has a small library of movies they have released. These include: