Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
The following questions are representative of the style and format of the exam you
will get on 11th May. They are a bit easier than the questions in the actual exam. You
should try and see if you can do five of the questions below in one hour (the actual
exam has five questions and asks you to attempt all five questions in two hours).
V = {v1 , v2 , v3 , v4 , v5 , v6 , v7 }
E = v1 v3 , v1 v5 , v2 v3 , v2 v5 , v3 v5 , v3 v7 , v4 v5 , v4 v7 , v5 v7 , v5 v6 , v6 v7 .
(a) Apply Kruskals Algorithm to G. List the edges of the forest that is grown, in
the order that they are added. [6]
(b) What is the weight of a minimum spanning tree in G? [4]
(a) Apply Dijkstras Algorithm to find the distance from v1 to every other vertex in
G, showing clearly the steps taken by the algorithm. [6]
(b) Draw a spanning tree in G such that for every vertex vi , the distance d(v1 , vi )
in G is the same as the distance d(v1 , vi ) in the tree. [4]
4. (a) Prove that a connected graph G is a tree if and only any pair of vertices is joined
by a unique path. [5]
(b) Let T be a tree, and let x and y be vertices in V (T ) such that e = xy is
not an edge of T . Prove the graph T + e defined by V (T + e) = V (T ) and
E(T + e) = E(T ) {e} has a unique cycle. [5]
V = {a, b, c, d, e, f }
E = {(ab, 2) (cb, 2), (cd, 2) (ed, 2), (ef, 2), (ac, 4), (be, 4), (df, 4)}
where the number following each edge is the capacity of that edge.
(a) A function f is defined on the edges of G with each edge e having f (e) equal
to the capacity of e. Explain why this defines a valid st-flow on G for suitably
chosen vertices s and t. [6]
(b) State the Max-Flow Min-Cut Theorem and explain how your answer to part (a)
illustrates this theorem. [4]
6. Consider the following st-network, in which each edge e is labelled with a capacity
c(e) and a flow function f (e) (given in brackets).
(a) Describe the conditions which the flow function f must satisfy. [2]
(b) Specify an f -unsaturated path from s to t and determine the slack value of this
path. [4]
(c) Using part (b) or otherwise, specify a maximum flow for the network. [4]
Page 2
8. (a) Algorithm A is applied to a graph G which has weighted edges. It checks to see
if there are two vertices u and v at which the sum of the weights of the incident
edges is equal. The output is all such pairs. If G has n vertices and O(n2 ) edges
explain why we might say that A has total running time O(n2 ). [6]
(b) A graph G = (V, E) with weighted edges is specified as follows:
V = {a, b, c, d, e}
E = {(ab, 4) (bd, 1), (de, 3) (ce, 2), (be, 1), (bc, 2)}
(a) State the Euler-Hierholzer Theorem and explain why it tells us that G can have
no Euler tour. [3]
(b) Construct a graph G from G by doubling certain edges in such a way that G
is Eulerian. [3]
(c) Use the Euler Tour Algorithm to find an Euler tour in G and hence specify a
minimum-length closed walk in G which passes every edge. [4]
Page 3
HINTS
1. The degrees are
vertex: 1 2 3 4 5 6 7
degree: 2 2 4 2 6 2 4
They are all even.
2+2+4+2+6+2+4 22
The graph has = = 11 edges (Handshaking Lemma)
2 2
so check your Euler tour has this many edges.
2. The forest only ever has 1 tree which starts by adding the three lowest-weight edges.
Total weight should be 8.
3. (a) After adding v1 to the Dijkstra tree the labels should be updated to
(b) The tree required is just the tree constructed by Dijstras algorithm. You should
draw this anyway since it is the output of the algorithm.
This tree should have total edge weight 5 but this is just to give a hint about what
the tree should be - the weight of the tree is NOT of interest in Dijkstras algorithm
so dont go adding edges in your answer!
4. (a) Remember tree = connected and no cycles. Draw a cycle passing u and v and
see why this means u and v dont have a unique path joining them. Why does the
unique path condition guarantee connected.
(b) This is a 2-part proof and you get 1 mark at least just for identifying the two
parts: (1) adding e creates a cycle; (2) this cycle is unique. This is actually Q1
of coursework 3, so check the solutions for a fully formal proof (but less than that
could still get full marks in the exam).
5. (a) Remember flow means sum of flow into x = sum of flow out of x for all vertices
x except s and t. So just confirm this is true for vertices b, c, d, e, using s = a and
t = f.
(b) Max-Flow Min-Cut: see the Extra box on the Week 6 page of the website.
You just need to say that flow value = total flow out of a = 6 = total capacity on
ab and ac which form a cut.
Page 4
1
8. (a) Checking all pairs for vertices is n2 steps which is n(n 1); for each pair
2
compare the weight sums. The words for each always indicates multiplication:
the running time is
n
number of steps to compare a weight sum.
2
(b) If you dont see how to get n2 in part (a) try doing part (b) first. How can you
make number of steps to compare a weight sum as quick as possible to apply?
9. (a) Remember maximal = cant extend = cant add an edge without making some
vertex lie in two matching edges.
(b) You will probably want to redraw the graph so that you have a top row X and
a bottom row Y (compare Coursework 8, Q3).
(c) The give augmenting path may not lie in your forest from part (b) never
mind! Just use it to improve the given matching.
Page 5