The Oracle of Bacon uses freely available database files from the Internet Movie Database's to handle 2 kinds of requests:
/
.
FILE | DESCRIPTION | MOVIES | ACTORS | EDGES |
---|---|---|---|---|
input8.txt | movies released in 2006 | 8 | 15 | 27 |
cast-06.txt | movies released in 2006 | 8780 | 84236 | 103815 |
cast-mpaa.txt | movies rated by MPAA | 21861 | 280624 | 627061 |
cast-rated.txt | popular movies | 4527 | 122406 | 217603 |
cast-all.txt | over 250,000 movies | 285462 | 933864 | 3317266 |
Movie 0/Bacon, Kevin/A Movie 1/A/B/C Movie 2/D/E/A/B Movie 3/E/F/G Movie 4/F/G/H Movie 5/H/I/J/K Movie 6/J/L/M/N Movie 7/A/B/C/D
Three different versions of the graph constructed from this file are below.
![]() |
|
Actor-Actor |
![]() |
|
Movie-Movie Graph |
![]() |
|
Actor-Movie Graph |
Compare and contrast the three methods for structuring the information? Which graph will be have the most vertices or edges? Which one will be easiest to implement?
createActorGraph
,
createActorMovieGraph
, and
createMovieGraph
methods in the Bacon
class to create the
initialize myGraph
(a Graph
structure that will
be used in traversal). You should use the already initialized
myActors
(maps from names to Actor
) and
myMovies
(maps from movie name to Movie
) objects. Time each one.
traverse
method in the Bacon
class, so that it
does a breadth-first traversal of the graphs and properly sets
the distance
and predecessor
values of each vertex.
degreeCentrality
,
closenessCentrality
, and
betweennessCentrality
methods in the Graph
class. What is the
big-Oh of each, in terms of V, the number of vertices, and
E, the number of edges.