Question
All files and needed codes to complete question in zipped folder ps11files = https://drive.google.com/file/d/13tzFVXMKEZTSkB9oMtpWAQAvFRiv6Y8L/view?usp=sharing For many years people have been interested in the question of
All files and needed codes to complete question in zipped folder ps11files = https://drive.google.com/file/d/13tzFVXMKEZTSkB9oMtpWAQAvFRiv6Y8L/view?usp=sharing
For many years people have been interested in the question of how connected social networks are. A famous experiment was carried out by Stanley Milgram in 1967. The experiment went something like this: Randomly chosen people in Omaha were given packets that included a letter addressed to a randomly chosen person in Boston. In the unlikely event that the resident of Omaha new the recipient, he was to send it directly. Otherwise, he was asked to select someone he knew who was more likely to know the recipient and send it on to them for forwarding. The question: On average, how many intermediaries before the letter reached its final destination? The answer turned out to be about 6. See http://en.wikipedia.org/wiki/Small-world_experiment. We can perform this type of experiment more easily nowadays using publicly available data, for example using the IMDB actor data. Let's say that if two actors worked on the same film, they are distance 1 apart. If actor 1 worked on a film with actor 2, and actor 2 worked on a film with actor 3, who worked on a film with actor 4, then we would say that the distance between actor 1 and actor 4 is 3 if there is no shorter path connecting them. In this exercise we will work with the files actresses.list and actors.list, which contain, for each actor in the database, a list of movies the actor appeared in. Here is a typical entry:
Cronin, Doug (I) Chasing Dreams (1982) [Sheriff]
<28> Scared Straight! (1978)
The movie information comprises several items besides movie name (date, role, tv or film, order in credits, etc). The actresses and actors files are quite large, and so we will work with compressed versions, actresses.list.gz and actors.list.gz, which are on Canvas and on Vocareum. Also in that subdirectory are several classes you can use, including RetrieveActors. The constructor takes a string argument that specifies the file from which to extract the actor data; you should give it the path name to actresses.list.gz and/or actors.list.gz. This class reads the compressed actor data without decompressing the entire file. It contains a method getNext() that returns a string for the next actor, or null if there are no more actor records in the file. The string comprises a list of strings separated by "@@@". The first string is the actor's name, and subsequent strings are the movies that the actor appeared in. Each movie string has two initial characters; a "TV" indicates that the title is a made-for-TV movie, a "TS" indicates a TV series or mini-series, a "VO" indicates a video, and "FM" indicates a film.
For example, the entry displayed above would be returned as
Cronin, Doug (I)@@@FMChasing Dreams (1982)@@@FMScared Straight! (1978)@@@
You do not need to be familiar with the details of how RetrieveActors works, or of the format of the IMDB files. The program BusyActress.java reads in the data from actresses.list.gz and determines which actress appeared in the most movies.
Write a program that creates a graph using the data in actresses.list.gz and actors.list.gz. You should have a vertex for each actor and an edge between two actors if they worked on a film together. (Consider only films; not tv shows or videos.) Your program should prompt for and accept two nonnegative integers on a line, each representing an index into the list of actors, and gives the distance between the two actors, with the chain of actors that connects them and the movies they appeared in. If there is no connection between the actors, your program should print out "No connection.". Use the graph classes on Vocareum or Canvas. In addition to the Graph implementations that are described in the Shaffer book, there is a Graphl.java implementation that uses a slightly different adjacency list implementation. That directory also contains a file shortestActors.list.gz, which is of the same format as the other actor files but with only 8 actors and 5 movies. You can check the distances you obtain with the solution in ActorsSmallWorld.pdf. Call your program SmallWorld. For part 1 your program should work for shortestActors.list.gz.
All files and needed codes to complete question in zipped folder ps11files = https://drive.google.com/file/d/13tzFVXMKEZTSkB9oMtpWAQAvFRiv6Y8L/view?usp=sharing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started