Homework 3
Try to solve these problems, and write out solutions on paper.
In an undirected graph , a bridge is an edge
,
such that the deletion of
disconnects
and
(there is no
path from
to
in
). Let
be the size of the
component of
in
, and similarly let
be the size of the
component of
in
. Say the size of the bridge
is
. We are interested in finding a bridge
in
of
maximum size.
You are to write a program MaxBridge.java. Running
java MaxBridge should read the file movies.txt (in
the current directory), and print out a description of the bridge
of maximum size. See hw3/Movies.java for an example program
reading movies.txt.
Your program should print out three lines of text: the name of the
movie (one endpoint of bridge ), the name of the actor (the other
endpoint of
) and the size of
(an integer). The first two
lines (the movie and actor) may be reversed. For example this
is incorrect output, but in the correct format:
North by Northwest (1959) Grant, Cary 17(The correct answer will not be nearly so famous.)
Besides the file movies.txt in the current directory, your program may also assume that share/hw3/book.jar is on the Java CLASSPATH, so you may use any of the classes defined there (it contains compiled versions of everything in share/book/). Or if you prefer, you may just modify any source code you like from share/book/, and incorporate that into your program.
Do not hard-code your answer, since I will also test your program on modified versions of movies.txt.
When you think you have found the correct output for the default movies.txt file, email it to me (mic@mathcs.emory.edu). I'll offer a small point bonus (and recognition, if you like) to the fastest correct solver.
For more details on how to copy the files and turnin, see hw3/Notes.txt. I'll also probably distribute some advice by email to the class mailing list.
Honor Policy
Your work for this class is governed by the Emory Honor Code. Programming work is also governed by the Math/CS SPCA (Statement of Policy on Computer Assignments). In particular, you should take care to protect the confidentiality of your homework files. Apparent honor code violations will be referred to the Emory Honor Council. If you have questions about what is allowed under the policy, please ask.