CS 4102, Algorithms
Problems Set #4, Spring 2010
Updated: March 3, 2010, 5pm
Homework 4 is a "short" homework, worth less the HWs 1 and 2.
There are fewer problems to turn in. Like HWs 1 and 2, you can
work alone or in groups of two -- see rules below (same as for HW1 and
2, different than HW 3).
To turn in:
Turn in solutions to these problems. (Below they're marked
with this image: )
- Algorithms textbook: none (but see practice problems)
- Gr-d, Gr-e, Gr-f
Important: Put the answer to each question on a separate sheet of
paper (or one problem on front and another
on the back). This is to make grading easier for us.
Collaboration Rules for This Assignment:
- There are many problems here. There are five to submit. For
the ones that are not required
to be submitted, you can collaborate or discuss in any way with as many
people as you wish.
- For the required problems that you submit:
- You may submit your work on your own or with up to two partners.
If you work with a partner, you must pledge that all partners did
approximately equal amounts of work on the required problems.
- If you work alone, you can discuss how to solve the problems with one
other group or one other single person. List the names of these
people on your submission.
- If you don't understand the question or what it is asking, you can get
clarification from other students only
if this does not involve saying how
the problem might be solved in any way.
If in doubt, don't discuss and see the TA or the instructor.
- Fill out the cover sheet on the website and submit
it with your homework.
Problems from Algorithms
textbook
(Solutions for problems marked "S" begin on page 656)
- Section 4.1, pp. 179f. Problems 1S, 2, 4S, 5, 7S, 9, 10S.
Also, do these same graphs with BFS.
- Section 4.1, pp. 179f. Problems 13S, 14, 17, 18. (Note: 18
is important.)
- Section 4.2, pp. 187f. Problems 13S, 14, 18 (like 18 above
really), 22 (relevant for one of the problems below).
Gr-a) Write an algorithm to find a vertex v
in a directed graph G where every other node in G is reachable
from v.
Gr-b) Describe how you would update the DFS implementation
for an undirected graph so that it determined
if the graph was acyclic.
Gr-c) When DFS is executed on an undirected graph G, explain why
there will not be any cross or descendent edges.
Gr-d) Given an
undirected graph G, the eccentricity of a node v is the largest
of the shortest possible
distances from v to any other node in the graph. The minimum
eccentricity in the graph is the graph radius
for G. All the nodes in G that have eccentricity equal to the graph
radius form a set called the graph center
of G.
Describe (using Python or very clear pseudo-code) an efficient
algorithm to find the graph center of a graph G, and describe its
complexity. (Note: we strongly urge you to make use of algorithms
studied in this section, and not to re-invent the wheel.)
Gr-e) A
bipartite graph is a graph where the vertices may be divided into two
subsets such that there is
no edge between any two vertices in the same subset. Write an algorithm
to determine if a graph is bipartite, and
give its worst-case complexity. Also, make your algorithm assign a
subset number (0 or 1) to each vertex. (Note: we strongly urge you to
make use of algorithms studied in this section, and not to re-invent
the wheel.)
Gr-f) For a
given undirected graph G, prove that the depth of a DFS tree cannot be
smaller than the depth
of the BFS tree. (Clearly state your proof strategy or technique.)