Difference between revisions of "WeightedgraphsTADM2E"
(Recovering wiki) 
m (Protected "WeightedgraphsTADM2E" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) 
(No difference)

Latest revision as of 18:43, 11 September 2014
Weighted Graph Algorithms
Simulating Graph Algorithms
61.
For the graphs in Problem (see book):
 Draw the spanning forest after every iteration of the main loop in Kruskal's algorithm.
 Draw the spanning forest after every iteration of the main loop in Prim's algorithm.
 Find the shortest path spanning tree rooted in $ A $.
 Compute the maximum flow from $ A $ to $ H $.
Minimum Spanning Trees
62.
Is the path between two vertices in a minimum spanning tree
necessarily a shortest path between the two vertices in the full graph?
Give a proof or a counterexample.
63.
Assume that all edges in the graph have distinct edge weights
(i.e., no pair of edges have the same weight).
Is the path between a pair of vertices in a minimum spanning tree
necessarily a shortest path between the two vertices in the full graph?
Give a proof or a counterexample.
64.
Can Prim's and Kruskal's algorithm yield different minimum spanning trees?
Explain why or why not.
65.
Does either Prim's and Kruskal's algorithm work if there are negative edge
weights?
Explain why or why not.
66.
Suppose we are given the minimum spanning tree $ T $ of a given graph $ G $
(with $ n $ vertices and $ m $ edges)
and a new edge $ e=(u,v) $ of weight $ w $ that we will add to $ G $.
Give an efficient algorithm to find the minimum spanning tree of the graph
$ G + e $.
Your algorithm should run in $ O(n) $ time to receive full credit.
67.
(a) Let $ T $ be a minimum spanning tree of a weighted graph $ G $.
Construct a new graph $ G' $ by adding a weight of $ k $ to every edge of $ G $.
Do the edges of $ T $ form a minimum spanning tree of $ G' $?
Prove the statement or give a counterexample.
(b) Let $ P=\{ s, \ldots, t \} $ describe a shortest weighted path between
vertices $ s $ and $ t $ of a weighted graph $ G $.
Construct a new graph $ G' $ by adding a weight of $ k $ to every edge of $ G $.
Does $ P $ describe a shortest path from $ s $ to $ t $ in $ G' $?
Prove the statement or give a counterexample.
68.
Devise and analyze an algorithm that takes a weighted graph $ G $ and
finds the smallest change in the cost to a nonMST edge that would
cause a change in the
minimum spanning tree of $ G $.
Your algorithm must be correct and run in polynomial time.
69.
Consider the problem of finding a minimum weight connected subset $ T $
of edges from a weighted connected graph $ G $.
The weight of $ T $ is the sum of all the edge weights in $ T $.
 Why is this problem not just the minimum spanning tree problem? Hint: think negative weight edges.
 Give an efficient algorithm to compute the minimum weight connected subset $ T $.
610.
Let $ G=(V,E) $ be an undirected graph.
A set $ F \subseteq E $ of edges is called a
feedbackedge set if every cycle of $ G $ has at least one edge in $ F $.
 Suppose that $ G $ is unweighted. Design an efficient algorithm to find a minimumsize feedbackedge set.
 Suppose that $ G $ is a weighted undirected graph with positive edge weights. Design an efficient algorithm to find a minimumweight feedbackedge set.
611.
Modify Prim's algorithm so that it runs in time $ O(n \log k) $
on a graph that has only $ k $ different edges costs.
UnionFind
612.
Devise an efficient data structure to handle
the following operations on a weighted directed graph:
 Merge two given components.
 Locate which component contains a given vertex $ v $.
 Retrieve a minimum edge from a given component.
613.
Design a data structure that can perform a sequence of, $ m $ union and {\em
find} operations on a universal set of $ n $ elements, consisting of a
sequence of all unions followed by a sequence of all finds,
in time $ O(m+n) $.
Shortest Paths
614.
The singledestination shortest path problem for a directed graph
seeks the shortest path from every vertex to a specified vertex
$ v $.
Give an efficient algorithm to solve the singledestination shortest paths
problem.
615.
Let $ G=(V,E) $ be an undirected weighted graph, and let $ T $ be the
shortestpath spanning tree rooted at a vertex $ v $.
Suppose now that all the edge weights in $ G $ are increased
by a constant number $ k $.
Is $ T $ still the shortestpath spanning tree from $ v $?
616.
Answer all of the following:
 Give an example of a weighted connected graph $ G=(V,E) $ and a vertex $ v $, such that the minimum spanning tree of $ G $ is the same as the shortestpath spanning tree rooted at $ v $.
 Give an example of a weighted connected directed graph $ G=(V,E) $ and a vertex $ v $, such that the minimumcost spanning tree of $ G $ is very different from the shortestpath spanning tree rooted at $ v $.
 Can the two trees be completely disjointed?
617.
Either prove the following or give a counterexample:
 Is the path between a pair of vertices in a minimum spanning tree of an undirected graph necessarily the shortest (minimum weight) path?
 Suppose that the minimum spanning tree of the graph is unique. Is the path between a pair of vertices in a minimum spanning tree of an undirected graph necessarily the shortest (minimum weight) path?
618.
In certain graph problems, vertices have can have weights instead of or in
addition to the weights of edges.
Let $ C_v $ be the cost of vertex $ v $, and $ C_{(x,y)} $ the cost of the edge
$ (x,y) $.
This problem is concerned with finding the cheapest path between vertices
$ a $ and $ b $ in a graph $ G $.
The cost of a path is the sum of the costs of the edges and vertices
encountered on the path.
 Suppose that each edge in the graph has a weight of zero (while nonedges have a cost of $ \infty $). Assume that $ C_v = 1 $ for all vertices $ 1 \leq v \leq n $ (i.e., all vertices have the same cost). Give an efficient algorithm to find the cheapest path from $ a $ to $ b $ and its time complexity.
 Now suppose that the vertex costs are not constant (but are all positive) and the edge costs remain as above. Give an efficient algorithm to find the cheapest path from $ a $ to $ b $ and its time complexity.
 Now suppose that both the edge and vertex costs are not constant (but are all positive). Give an efficient algorithm to find the cheapest path from $ a $ to $ b $ and its time complexity.
619.
Let $ G $ be a weighted directed
graph with $ n $ vertices and $ m $ edges, where all edges have positive weight.
A directed cycle is a directed path that starts and ends at the same
vertex and contains at least one edge.
Give an $ O(n^3) $ algorithm to find a directed cycle in $ G $ of minimum total
weight.
Partial credit will be given for an $ O(n^2 m) $ algorithm.
620.
Can we modify Dijkstra's algorithm to solve the
singlesource longest path problem by changing {\em
minimum} to maximum?
If so, then prove your algorithm correct.
If not, then provide a counterexample.
621.
Let $ G=(V,E) $ be a weighted acyclic directed graph with possibly negative
edge weights.
Design a lineartime algorithm to solve the singlesource shortestpath
problem from a given source $ v $.
622.
Let $ G=(V,E) $ be a directed weighted graph such that all the weights are
positive.
Let $ v $ and $ w $ be two vertices in $ G $ and $ k \leq V $ be an integer.
Design an algorithm to find the shortest path from $ v $ to $ w $ that contains
exactly $ k $ edges.
Note that the path need not be simple.
623.
Arbitrage is the use of discrepancies in currencyexchange rates to
make a profit.
For example, there may be a small window of time during
which 1 U.S. dollar buys 0.75 British pounds, 1 British pound buys
2 Australian dollars, and 1 Australian dollar buys 0.70 U.S. dollars.
At such a time, a smart trader can trade one U.S. dollar and end up with
$ 0.75 \times 2 \times 0.7 = 1.05 $ U.S. dollarsa profit of 5%.
Suppose that there are $ n $
currencies $ c_1,...,c_n $ and an $ n \times n $ table $ R $ of exchange rates, such
that one unit of currency $ c_i $ buys $ R[i,j] $ units of currency $ c_j $.
Devise and analyze an algorithm to determine the maximum value of
$ R[c_1,c_{i1}] \cdot R[c_{i1},c_{i2}] \cdots R[c_{i{k1}},c_{ik}] \cdot R[c_{ik},c_1] $
Hint: think allpairs shortest path.
Network Flow and Matching
624.
A matching in a graph is a set of disjoint edgesi.e., edges
that do not share any vertices in common.
Give a lineartime algorithm to find a maximum matching in a tree.
625.
An edge cover of an undirected graph $ G=(V,E) $ is a set of edges such
that each vertex in the graph is incident to at least one edge from the set.
Give an efficient algorithm, based on matching,
to find the minimumsize edge cover for $ G $.