5 Solved Questions on Algorithmic Graphs - Assignment 3 | CMSC 451, Assignments of Computer Science

Material Type: Assignment; Professor: Khuller; Class: DSG&AN CMPTR ALGOR; Subject: Computer Science; University: University of Maryland; Term: Spring 2009;

Typology: Assignments

Pre 2010

Uploaded on 07/30/2009

koofers-user-oe8
koofers-user-oe8 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Spring 2009 CMSC 451: Homework 3 Samir Khuller
Feb 26
(1) Describe an efficient algorithm that given an undirected graph G, determines a span-
ning tree of Gwhose largest edge weight is minimum, over all spanning trees of G.
Give an argument justifying your algorithm.
(2) The diameter of a tree T= (V, E ) is given by
max
u,vVδ(u, v)
where δ(u, v) is the distance between uand vin the tree T. Give an O(|V|) algorithm
for computing the diameter of the tree. Write a proof of correctness for your algorithm.
(3) In a directed graph, a get-stuck vertex is one that has in-degree |V| 1 and out-
degree 0. Assume that the adjacency matrix representation is used. Design an O(|V|)
algorithm to determine if a given graph has a get-stuck vertex. (Yes, this problem
can be solved without even looking at the entire input matrix.) Write a proof of
correctness for your algorithm.
(4) Assume that we have a network (a connected undirected graph) in which each edge ei
has an associated bandwidth bi. If we have a path P, from sto v, then the capacity of
the path is defined to be the minimum bandwidth of all the edges that belong to the
path P. We define capacity(s, v) = maxP(s,v )capacity(P). (Essentially, capacity(s, v)
is equal to the maximum capacity path from sto v.) Give an efficient algorithm to
compute capacity(s, v), for each vertex v; where sis some fixed source vertex. Show
that your algorithm is “correct”, and analyze its running time.
(Design something that is no more than O(|V|2), and with the right data structures
takes O(|E|log |V|) time.)
(5) Let Gbe a directed graph. The vertices of Ghave been numbered 1 . . . n (where nis
the number of vertices in G). Let small(i) = min{j|jis reachable from i}. In other
words, for a vertex numbered i,small(i) is the smallest numbered vertex reachable
from it. Design an O(V+E) algorithm to compute small(i) for al l vertices in the
graph.
1

Partial preview of the text

Download 5 Solved Questions on Algorithmic Graphs - Assignment 3 | CMSC 451 and more Assignments Computer Science in PDF only on Docsity!

Spring 2009 CMSC 451: Homework 3 Samir Khuller

Feb 26

(1) Describe an efficient algorithm that given an undirected graph G, determines a span- ning tree of G whose largest edge weight is minimum, over all spanning trees of G. Give an argument justifying your algorithm.

(2) The diameter of a tree T = (V, E) is given by

max u,v∈V δ(u, v)

where δ(u, v) is the distance between u and v in the tree T. Give an O(|V |) algorithm for computing the diameter of the tree. Write a proof of correctness for your algorithm.

(3) In a directed graph, a get-stuck vertex is one that has in-degree |V | − 1 and out- degree 0. Assume that the adjacency matrix representation is used. Design an O(|V |) algorithm to determine if a given graph has a get-stuck vertex. (Yes, this problem can be solved without even looking at the entire input matrix.) Write a proof of correctness for your algorithm.

(4) Assume that we have a network (a connected undirected graph) in which each edge ei has an associated bandwidth bi. If we have a path P , from s to v, then the capacity of the path is defined to be the minimum bandwidth of all the edges that belong to the path P. We define capacity(s, v) = maxP (s,v) capacity(P ). (Essentially, capacity(s, v) is equal to the maximum capacity path from s to v.) Give an efficient algorithm to compute capacity(s, v), for each vertex v; where s is some fixed source vertex. Show that your algorithm is “correct”, and analyze its running time. (Design something that is no more than O(|V |^2 ), and with the right data structures takes O(|E| log |V |) time.)

(5) Let G be a directed graph. The vertices of G have been numbered 1... n (where n is the number of vertices in G). Let small(i) = min{j|j is reachable from i}. In other words, for a vertex numbered i, small(i) is the smallest numbered vertex reachable from it. Design an O(V + E) algorithm to compute small(i) for all vertices in the graph.