Home / Expert Answers / Computer Science / suppose-you-have-data-for-hollywood-in-the-following-format-first-there-is-a-number-telling-us-the-pa522

(Solved): Suppose you have data for Hollywood in the following format. First, there is a number telling us the ...



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.

 

  1. 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!)

 

  1. 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.

 

  1. 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.



We have an Answer from Expert

View Expert Answer

Expert Answer


There are several ways to read a plain text file in Java e.g. you can use FileReader, BufferedReader, or Scanner to read a text file. I have created a text file actors.txt (upload the image of text file) and parse that file using BufferedReader and S
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe