Title: Challenge%20Problem%201
1Challenge Problem 1
Let us design a keyboard for a mechanical hand.
The keyboard has 26 letters A, B, , Z
arranged in one row. The hand is always at the
left end of the row and it comes back to the left
end after pressing a key. Assume that we know the
frequency of every letter. Design the order of
the 26 letters in the row such that the average
length of movement of the mechanical hand is
minimized. Prove that your solution is
correct. No mark will be given. I will remember
who did it. If you can solve this problem, then
the chance that you can get A is high. If you
can do it, send your solution by e-mail to
zhyong_at_cs.cityu.edu.hk with the subject CS 3335
Challenge Problem 1 before Oct. 20. We can
discuss the solution after Oct. 20.
2Minimum-cost Arborescence of a Directed Graph
- Problem
- Given a weighted directed graph G(V,E,W) and
a node as a root. Find a directed
spanning tree rooted at r with the smallest cost. - Directed spanning tree rooted at r.
- Every node except r has in-degree 1 and there
is a directed path from r to v for any
3A set of (n-1) edges is an arborescence with
respect to root r if and only if there is no
cycle, and for each node v, there is
exactly one edge that enters v.
r
r
r
Example
4Algorithm
- For each node
- Let yv be the minimum cost of an edge
entering node v - Modify the costs of all edges e entering v
to ce ce yv - Choose on 0-cost edge entering ,
obtaining a set F. - If F forms an arborescence, then return it
- Else there are directed cycles
- Construct C to a single supernode, yielding a
graph G(V,E) - Recursively find an optimal arborescence
(V,F) in G with cost ce - Extend (V,F) to an arborescence (V,F) in G
by adding all but - one edge of
C
5Example 1
r
r
r
1
2
2
8
6
10
10
10
10
0
0
1
4
1
4
0
0
2
2
2
2
4
0
8
4
8
4
ce ce yv
yv
6Example 1 (Contd)
r
r
r
r
2
8
6
1
1
4
0
0
2
2
Supernode
0
0
Supernode
4
0
0
0
(V,F)
F
7Example 2
r
r
8
10
10
8
5
5
1
2
1
2
1
2
1
2
4
4
3
3
1
1
8
8
10
10
4
4
7
7
2
2
2
2
3
3
yv
8r
7
9
r
4
0
0
0
0
0
0
1
0
0
0
0
0
0
6
8
3
5
0
0
0
0
0
0
ce ce yv
F
9r
7
9
r
4
8
4
3
0
0
0
0
0
0
1
0
0
0
0
0
0
0
6
8
3
3
3
0
5
0
0
0
0
0
0
0
F
Contraction
10r
0
0
0
0
0
0
0
0
0
0
0
0
F
11r
r
4
8
0
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
12Result
r
0
r
8
0
0
0
0
0
1
2
2
0
4
0
1
0
0
0
0
7
2
0
3
Example 2, Lemma1, Lemma 2 and Theorem are fun
part. Not required.
13Lemma 1
- If (V, F) is an arborescence, then it is a
minimum-cost arborescence. - Proof
- For an arborescence, every node has one in-edge.
- F contains the shortest in-edge for each node.
- Thus, the cost of any arborescence ?cost of F.
14Lemma 2
- T is an optimal arborescence in G subject to cost
ce if and only if it is an optimal arborescence
subject to the modified costs ce. - Proof For any arborescence T,
- Since is fixed for any fixed graph, if
-
- is minimized, so is
-
-
15Theorem (it means that we can treat each
cycle as a node.)
- Let C be a cycle in G consisting of edges of cost
0, such that . Then there is an optimal
arborescence rooted at r that has exactly one
edge entering C. - Proof If in an optimal solution T there are two
edges (length?0) entering C, we can just use one
edge entering C and use 0 edges in C to - replace other entering edges.
0
0
0
0