Suppose you have data for Hollywood in the following format. First, there is a number telling us the number of movies. For each movie, we have a title, then a number with the number of actors, then the names of each actor. For example, here is a very small file for only 3 movies:
3
Apollo 13
5
Tom Hanks
Kevin Bacon
Bill Paxton
Ed Harris
Gary Sinise
Footloose
5
Kevin Bacon
Lori Singer
John Lithgow
Diane West
Sarah Jessica Parker
Tremors
4
Kevin Bacon
Fred Ward
Finn Carter
Reba McEntire
Imagine we have a much larger version of this file covering thousands and thousands of Hollywood movies.
Explain how to parse the data file (you can write pseudocode but you don’t need to write full Java code) and create a Graph using our Graph code such that actors are nodes and there are undirected edges between actors who have been in at least one film together. (Hint: Don’t overthink this!)
We want to know if Kevin Bacon really is 6 degrees away from every other actor in Hollywood! Explain how to use the graph you created in part A to determine if Kevin Bacon is at most 6 degrees away from every other actor. You can use any of the major graph algorithms we covered in class.
Is everyone in Hollywood at most 6 degrees away from everyone else? Explain how you would solve this with the graph you built in part A.