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: Submit-Button)

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:

  1. 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.
  2. For the required problems that you submit:
    1. 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.
    2. 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.
    3. 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.
  3. 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)
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) Submit-Button 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) Submit-Button 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) Submit-Button 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.)