Homework 4 Solution

# B find a shortest walk w with endpoints p h that

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 00 11 00 11 00 4 i 5 1 1 0 1 0 1 0 5 a 6 11 00 11 3 00 1 0 6 h 1 0 1 0 1 0 8 9 1 00 11 11 00 11 00 f g (a) Let S = {h, c, d, g }. For each pair of vertices x, y ∈ S , ﬁnd a shortest path with endpoints x, y and also d(x, y ). (b) Find a shortest walk W , with endpoints p, h, that visits every edge of G at least once. What is the weight of the walk that you found? Solution. (a) By trials and errors (or by inspection, or by Dijkstra’s algorithm), we ﬁnd the following table where each entry represents a shortest path and its length. Since there is a symmetry in it, we only give the entries that are above the diagonal. h c d g h – – – – c h, e, b, c; 8 – – – d h, e, d; 7 c, b, e, d; 7 – – g h, i, f, g ; 8 c, b, e, i, f, g ; 9 d, e, i, f, g ; 8 – (b) In a walk that begins at h and ends at p, the degrees of all vertices, except those of h, p, must be even while the degrees of p and h must be odd. Now since the degrees of c, d, g are odd and that of h is even, we see that it is not possible to have a walk from p to h that uses each edge of G exactly once. That is, in order to have a walk that uses every edge at least once, some edges have to be repeated. Which edges to repeat? Well, the repeated edges must form paths between the vertices c, d, g, h. In order for the walk to have a minimum weight, we see that we need two paths between the vertices c, d, g, h so that each vertex is the endpoint of exactly one path. The graph below represents the shortest distance between the vertices h, c, d, g . h c 8 7 7 d 8 89 g By trials and errors (or by a minimum weight perfect matching algorithm), one ﬁnds that the shortest path between c, d (represented by the edge {c, d}) and the shortest path between g, h (represented by the edge {g, h}) have a minimum total distance of 15. Thus, we should repeat the edges on the shortest paths c, b, e, d and h, i, f, g . We therefore have the following graph (where the dotted lines represent repeated edges): c 7 2 p 4 e i 3 1 3 2 5 61 5 a 1 f 4 h 8 3 b2 4 d 8 g 6...
View Full Document

## This note was uploaded on 01/13/2014 for the course MAD 5305 taught by Professor Suen during the Spring '12 term at University of South Florida - Tampa.

Ask a homework question - tutors are online