CS 573: Graduate Algorithms, Fall 2011
HW 3 (due in class on Tuesday, October 18th)
This homework contains ﬁve problems.
Read the instructions for submitting homework on
the course webpage
. In particular,
make sure
that you write the solutions for the problems on
separate sheets of paper. Write your name and netid on each sheet.
Collaboration Policy:
For this home work students can work in groups of up to three students
each. Only one copy of the homework is to be submitted for each group. Make sure to list all the
names/netids clearly on each page.
Note on Proofs:
Details are important in proofs but so is conciseness. Striking a good balance
between them is a skill that is very useful to develop, especially at the graduate level.
1. (20 pts) Given a directed graph
G
= (
V,E
) and two nodes
s,t
, an
s

t
walk
is a sequence of
nodes
s
=
v
0
,v
1
,...,v
k
=
t
where (
v
i
,v
i
+1
) is an edge of
G
for 0
≤
i < k
. Note that a node
may be visited multiple times in a walk — this is how it diﬀers from a path. Given
G,s,t
and an integer
k
≤
n
, design a linear time algorithm to check if there is an
s

t
walk in
G
that visits at least
k
distinct
nodes including
s
and
t
.
Hint:
You need to use a linear time
algorithm to ﬁnd all strong connected components of a directed graph. Moreover you need
to understand the DAG representation of the strong connected components of a graph. You
can assume that you have an algorithm for giving you such a representation. Read Chandra’s
CS 473 lecture notes if you are unfamiliar with this.
2. (20 pts) You are given a directed graph
G
= (
V,E
) where each edge
e
has a length/cost
c
e
(which may be negative) and you want to ﬁnd shortest path distances from a given node
s
to all the nodes in
V
. The BellmanFord algorithm takes
O
(
nm
) time where
n
=

V

and
m
=

E

while Dijkstra’s algorithm can be implemented in
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Chekuri,C
 Algorithms, Graph Theory, Dijkstra, length/cost ce, Suppse G

Click to edit the document details