Exercises Block1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Algorithms and Complexity Group

Institute of Computer Graphics and Algorithms


TU Wien
Exercises for
Algorithmics
186.814 VU 6.0 - WS 2015/16
Sheet 1
The following exercises should be prepared for the exercise lesson on 23 October 2015.
By 22 October 2015, 23:50, the solutions must be uploaded to TUWEL as a single pdf-file, and the solved
exercises must be indicated.
Exercise 1 Max Flow
Consider following directed graph G = (V, E) with source node s and sink node t and capacities as given in
the picture.
1
2
4
2
2
2
s
t
1
1
2

1
3

Compute a maximum flow by means of the Ford-Fulkerson algorithm. Specify the residual network
before each augmentation.
Specify a minimum cut corresponding to the maximum flow.

Exercise 2 Reducing the Flow


You are given a directed graph G = (V, E) with source node s and sink node t and all edges have capacity 1.
Now you are asked to reduce the value of a max flow as much as possible by deleting at most k edges. Describe
how you can determine in polynomial-time which edges should be deleted.
Exercise 3 Circulations
Consider following directed graph G = (V, E).
x

Suppose that all edges have capacity 2, and the nodes have the following demands d(x) = 4, d(w) = 0,
d(u) = 3, d(v) = 1.
(a) Determine whether the graph admits a circluation. Proceed by reducing the circluation problem with
demands to a max flow problem, using the construction from the lecture.
(b) Assume that the edge w v has the lower bound 2, all other edges have the lower bound 0. Determine
whether the graph admits a circluation. Proceed by reducing the circluation problem with demands
and lower bounds to a max flow problem, using the construction from the lecture.
1

Exercise 4 Changing Capacities


Suppose you have a directed graph G = (V, E) with source s, sink t and integer capacities c(e) for e E.
(a) Suppose you have solved a maximum flow problem on a the graph and then increase the capacity of
one edge by k. How much can the value of a maximum flow increase? Show that by the augmenting
path algorithm you can compute a maximum flow with respect to the new capacities in time O(k|E|).
(b) Let (A, B) be a minimum cut of G with respect to the capacities c(e) for e E. Now increase the
capacities of all edges by 1. Is (A, B) still a minimum cut (either give a proof or a counterexample).
Instead of increasing the capacities by 1, suppose the capacities are doubled. Is (A, B) still a minimum
cut (either give a proof or a counterexample).

Exercise 5 Bipartite Matchings


Let G = (L R, E) be a bipartite graph, M E a maximum matching of G, and let x L, y R be nodes
that are not incident to an edge in M .
(a) Show that there is no path P from x to y in G such that the edges on P are alternatingly outside of
M and in M (such a path is called alternating).
(b) Show that there exists a subset C E \ M such that every path between x and y in G uses at least
one edge of M .

Exercise 6 Dijkstras Shortest Path Algorithm


Provide an example network using negative edge weigths on which Dijkstras shortest path algorithm
fails!
Is it possible to obtain shortest paths on a graph with negative weights by adding the minimal weight
to all edge weights and then applying Dijkstras shortest path algorithm (either give a proof or a
counterexample)?

Exercise 7 Floyd-Warshall Algorithm


Apply the Floyd-Warshal algorithm as presented in the lecture to the given graph.
4
3

-2

1
3

5
4

2
7

-3

Exercise 8 Modeling as Shortest Path Problem


The following table illustrates a number of possible duties for the drivers of a bus company. We wish to
ensure, at the lowest possible cost, that at least one driver is on duty for each hour of the planning period
(9 AM to 5 PM). Formulate and solve this scheduling problem as shortest path problem.
Duty hours
Cost

9-13
30

9-11
18

11-15
21

12-17
42

14-17
20

13-16
32

16-17
15

Exercise 9 Delay Constrained Shortest Path


We are given a network N = (G, w, d), G = (V, A) together with a designated source node s V and target
node t V , where w : A Z+ and d : A Z+ . The values wij correspond to arc weights, dij correspond
to delays, i.e., using the arc (i, j) requires dij time. We are further given a positive number D N, the delay
constraint. Develop an efficient, i.e., O(D |A|), algorithm
to find a shortest path P from some s to t, which
P
does not exceed the global delay constraint D, i.e., (i,j)P dij D (Hint: use a similar approach as the
one used in the Bellman Ford algorithm).

You might also like