MATH6105 Algorithmic Graph Theory: Practice Questions The

advertisement
MATH6105 Algorithmic Graph Theory: Practice Questions
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).
1. Consider the following graph G = (V, E):
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) Draw the graph.
[3]
(b) What condition is satisfied by the vertex degrees which guarantees that G has
an Euler tour?
[2]
(c) Write down an Euler tour of G which begins and ends at v1 (you need not show
how this tour is constructed).
[5]
2. Consider the following graph:
(a) Apply Kruskal’s 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]
3. Consider the following graph G:
(a) Apply Dijkstra’s 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]
5. A network G = (V, E) as follows:
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.
7. (a) State the Handshaking Lemma for an undirected graph G.
[4]
[4]
(b) A graph G with edge set E has four vertices of odd degree: v1 , v2 , v3 and v4 .
Suppose a new graph G′ is constructed by adding a new vertex z which has
edges to each of the vi , i = 1, . . . , 4. By considering the graph G′ , prove that G
contains two disjoint trails T1 and T2 whose union is E.
[6]
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)}
Apply algorithm A from part (a) to this graph.
[4]
9. Consider the following bipartite graph G which has parts X = {a, d, f, h} and Y =
{b, c, e, g}.
A matching M in G has been indicated by heavily-drawn edges.
(a) Explain why M is maximal.
[2]
(b) Starting from the forest which has no edges and vertex set X0 = {h}, construct
a maximal M -alternating forest in G.
[4]
(c) Explain why the path P = bd, de, eh is an M -augmenting path in G and use it
to find a matching of greater cardinality than M .
[4]
10. Consider the following edge-labelled graph G:
(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
(v1 , 1), (v1 , 4), (v1 , 7), (v1 , ∞).
(b) The tree required is just the tree constructed by Dijstra’s 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 Dijkstra’s algorithm
so don’t 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 don’t 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.
6. (a) See Q5(a).
(b) The unsaturated path has to use vw as a ‘backwards’ edge!. The path has slack
value 1.
(c) You should get maximum flow = 7.
7. (a) See Question 1.
(b) Observe that G′ is Eulerian. Now think about an Euler trail in G′ : what is left
when you delete z to get back to G?
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 don’t 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 = can’t extend = can’t 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.
10. (a) See Week 10 Lecture Notes 2 on the website.
(b) & (c) This is not a Chinese Postman problem since there are no edge weights.
Have a look at Week 11, Lecture Notes 1.
Page 5
Download