Question: What would be the answer for this problem ? 1. Graphs (Loosely based on the small world phenomenon exercise from S&W, see here: http://www.cs.princeton.edu/courses/archive/spring03/cs226/assignments/bacon.html. Briefly,
What would be the answer for this problem ?

1. Graphs (Loosely based on the "small world phenomenon" exercise from S&W, see here: http://www.cs.princeton.edu/courses/archive/spring03/cs226/assignments/bacon.html. Briefly, the assignment asks you to read in a file containing information about films and actors, and find the Bacon number (or whoever is the center of the universe) of an actor given as a parameter. Your task is to write a class named DegreesOfSeparationBFS that builds a shortest paths graph from a center, say Kevin Bacon (or any other actor) based on a SymbolGraph read from a file. Then it can take an actor's name and produces this actor's Bacon number and the shortest path to Kevin Bacon (or whoever the center is). The name format is "Last, First" . So for an input of: "Kidman, Nicole" It has to calculate Nicole Kidman's Bacon number (2) and the path in the graph: Kidman, Nicole -> My Life (1993 I) with de Sosa, Ruth -> Planes, Trains & Automobiles (1987 with Bacon, Kevin You may use the DegreesOfSeparation class for ideas (see S&W code). Make sure that you understand the SymbolGraph class very well before you start coding. An illustration appears in the Undirected Graphs class notes. Notice that the original assignment asks you to calculate a histogram, but the part that writes the histogram is already implemented by S&W: https://algs4.cs. princeton.edu/41graph/BaconHistogram.java.html. Therefore, it is not going to be tested as part of my test suite, but you should print out the histogram to your memo . txt file (see below). The original assignment has you read the actor names from the standard input but this is not what you have to do here. Specific Instructions: . The DegreesOfSeparationBFS class has two class variables: a SymbolGraph and a BreadthFirstPaths, with the appropriate getters called getSymbolGraph () and getBreadthFirstPaths() (Don't forget the getters! I need them!). . You should be able to instantiate it, so the constructor has to be public. The constructor gets three Strings: a File name, a delimiter and a source. For example: DegreesOfSeparationBFS ("movies. txt" "/" , "Bacon, Kevin"). Notice the name format is Last, First. The constructor builds the symbol graph and calculates the distance. . In addition to the getters, the class should implement the following functions (at least. You can add more as you see fit): - int baconNumber (String sink). This function gets a String in the format "Last, First" (for example "Kidman, Nicole") and calculates the actor's beacon number. In the case of Nicole Kidman it should return 2. If the actor is not in the database or there is no path from the center to it, it should return -1. Stack
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
