





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Some of these lecture slides are adapted from material in:
Cycle.^ n
A cycle is a set of arcs of the form {a,b}, {b,c}, {c,d},.. ., {z,a}. Cut.^ n
The cut induced by a subset of nodes S is the set of all arcs withexactly one endpoint in S.
Path = 1-2-3-4-5-6-1Cycle = {1, 2}, {2, 3}, {3, 4},
1
3 8
2
6 7
4
5
S = {4, 5, 6}Cut = {5, 6}, {5, 7}, {3, 4},
1
3 8
2
6 7
4
5
3
A cycle and a cut intersect in an even number of arcs.Proof.
1
3 8
2
6 7
4
5
Intersection = {3, 4}, {5, 6}
Spanning tree. Let T = (V, F) be a subgraph of G = (V, E). TFAE:^ n
T is a spanning tree of G. n^
T is acyclic and connected. n^
T is connected and has |V| - 1 arcs. n^
T is acyclic and has |V| - 1 arcs. n^
T is minimally connected: removal of any arc disconnects it. n^
T is maximally acyclic: addition of any arc creates a cycle. n^
T has a unique simple path between every pair of vertices. 1
3 8
2
6 7
4
5
1
3 8
2
6 7
4
5
5
Minimum spanning tree. Given connected graph G with real-valuedarc weights c
, ane
MST is a spanning tree of G whose sum of arc
weights is minimized. Cayley’s Theorem (1889). There are n
n-
spanning trees of K
.n
n^
n = |V|, m = |E|. n^
Can’t solve MST by brute force.
1
3 8
(^267)
4
5
5
23
10
21
14
24
16 4 6
18
(^97)
11
8
1
3 8
(^267)
4
5
5
4 6
(^97)
11
8
w(T) = 50
MST is central combinatorial problem with divserse applications.^ n
Designing physical networks.^ –
telephone, electrical, hydraulic, TV cable, computer, road
n^
Cluster analysis.^ –
delete long edges leaves connected components – finding clusters of quasars and Seyfert galaxies – analyzing fungal spore spatial patterns
n^
Approximate solutions to NP-hard problems.^ –
metric TSP, Steiner tree
n^
Indirect applications.^ –
describing arrangements of nuclei in skin cells for cancer research – learning salient features for real-time face verification – modeling locality of particle interactions in turbulent fluid flow – reducing data storage in sequencing amino acids in a protein
7
Optimal message passing.^ n
Distribute message to N agents. n^
Each agent can communicate with some of the other agents, but theircommunication is (independently) detected with probability p
.ij^
n^
Group leader wants to transmit message (e.g., Divx movie) to allagents so as to minimize the total probability that message is detected. Objective.^ n
Find tree T that minimizes: n^
Or equivalently, that maximizes: n^
Or equivalently, that maximizes: n^
Or equivalently, MST with weights p
.ij^
pij
( i ,
j )∈
T ∏
p
ij
( i ,
j ) ∏∈ T^ log 1
pij
( i ,
j )
Fundamental cycle.^ n
Adding any non-tree arc e to T forms unique cycle C. n^
Deleting any arc f
C from T
{e} results in new spanning tree.
Cycle optimality conditions: For every non-tree arc e, and for everytree arc f in its fundamental cycle: c
≤f c
.e
Observation: If c
cf
e^
then T is not a MST.
1
3 8
2
6
7
4
5
f
e
9
13
Red rule.^ n
Let
C be a cycle with no red arcs. Select an uncolored arc of C of max weight and color it red.
Blue rule.^ n
Let D be a cut with no blue arcs. Select an uncolored arc in D ofmin weight and color it blue.
Greedy algorithm.^ n
Apply the red and blue rules (non-deterministically!) until all arcsare colored. The blue arcs form a MST. n^
Note: can stop once n-1 arcs colored blue.
Theorem. The greedy algorithm terminates. Blue edges form a MST.Proof. (by induction on number of iterations)^ n
Base case: no arcs colored
every MST satisfies invariant.
n^
Induction step: suppose color invariant true before blue rule.^ –
let D be chosen cut, and let f be arc colored blue – if f
T, T still satisfies invariant
-^
o/w, consider fundamental cycle C by adding f to T*
-^
let e
C be another arc in D
-^
e is uncolored and c
e^
cf
since
e^
not red
blue rule
not blue, c
e^
cf
-^
{ f } - { e } satisfies invariant
f e T*
Color Invariant: There exists a MST T* containing all the bluearcs and none of the red ones.
15
Theorem. The greedy algorithm terminates. Blue edges form a MST.Proof. (by induction on number of iterations)^ n
Base case: no arcs colored
every MST satisfies invariant.
n^
Induction step: suppose color invariant true before blue rule.^ –
let D be chosen cut, and let f be arc colored blue – if f
T, T still satisfies invariant
-^
o/w, consider fundamental cycle C by adding f to T*
-^
let e
C be another arc in D
-^
e is uncolored and c
e^
cf
since
e^
not red
blue rule
not blue, c
e^
cf
-^
{ f } - { e } satisfies invariant
Color Invariant: There exists a MST T* containing all the bluearcs and none of the red ones.
red f e
C
cycle
red
e
e^
∉
T*
cut D
deleting e from
f^ ∈
D
C
f
f^
∉
T*
blue
red rule
f not red
Proof (continued).^ n
Induction step: suppose color invariant true before red rule.^ –
cut-and-paste
n^
Either the red or blue rule (or both) applies.^ –
suppose arc e is left uncolored – blue edges form a forest
Case 1
e
Case 2 e
17
Prim’s algorithm. (
Jarník 1930, Dijkstra 1957, Prim 1959)
n^
S = vertices in tree connected by blue arcs. n^
Initialize S = any vertex. n^
Apply blue rule to cut induced by S.
1
3 8
2 6
7
4
5
O(m + n log n)
O(n
Fib. heap
array
PQinit()
for each v
key(v)
pred(v)
nil
PQinsert(v, Q)
key(s)
while (!PQisempty(Q))
v = PQdelmin(Q)for each w
Q s.t {v,w}
if key(w) > c(v,w)
PQdeckey(w, c(v,w))pred(w)
v
Prim’s Algorithm
19
O(m + n log n)
O(n
Fib. heap
array
PQinit()
for each v
key(v)
pred(v)
nil
PQinsert(v, Q)
key(s)
while (!PQisempty(Q))
v = PQdelmin(Q)for each w
Q s.t {v,w}
if key(w) > c(v,w)
PQdeckey(w, c(v,w))pred(w)
v
Prim’s Algorithm
c(v,w) + key(v)
Dijkstra’s
Kruskal’s algorithm (1956).^ n
Consider arcs in ascending order of weight. –^
if both endpoints of e in same blue tree, color red by applyingred rule to unique cycle
-^
else color e blue by applying blue rule to cut consisting of allvertices in blue tree of one endpoint
1
(^38)
2 6
7
4
5
Case 1: {5, 8}
1
(^38)
2 6
7
4
5
Case 2: {5, 6}
25
Random sampling algorithm.
(Karger, Klein, Tarjan, 1995)
n^
If lots of nodes, use Boruvka.^ –
decreases number of nodes by factor of 2
n^
If lots of edges, delete useless ones.^ –
use random sampling to decrease by factor of 2
n^
Expected running time is O(m + n).
Definition. Given graph G and forest F, an edge e is F-heavy if bothendpoints lie in the same component and c
e^
c
for all edges f onf
fundamental cycle.^ n
Cycle optimality conditions: T* is MST
no T*-heavy edges.
n^
If e is F-heavy for any forest F, then safe to discard e.^ –
apply red rule to fundamental cycles
Verification subroutine. (Dixon-Rauch-Tarjan, 1992).^ n
Given graph G and forest F, is F is a MSF? n^
In O(m + n) time, either answers (i) YES or (ii) NO and output allF-heavy edges.
1
(^38)
2
6 7
4
5
Forest FF-heavy edges
27
Random sampling.^ n
Obtain G(p) by independently including each edge with p = 1/2. n^
Let F be MSF in G(p). n^
Compute F-heavy edges in G. n^
Delete F-heavy edges from G.
1
3
8
2
6 7
4
5
Random sampling.^ n
Obtain G(p) by independently including each edge with p = 1/2. n^
Let F be MSF in G(p). n^
Compute F-heavy edges in G. n^
Delete F-heavy edges from G. G(1/2)
1
3
8
2
6 7
4
5
29
Random sampling.^ n
Obtain G(p) by independently including each edge with p = 1/2. n^
Let F be MSF in G(p). n^
Compute F-heavy edges in G. n^
Delete F-heavy edges from G. G(1/2)
1
3
8
2
6 7
4
5
MSF F in G(1/2)
Random sampling.^ n
Obtain G(p) by independently including each edge with p = 1/2. n^
Let F be MSF in G(p). n^
Compute F-heavy edges in G. n^
Delete F-heavy edges from G. G
1
3
8
6 7
4
5
2
F-heavy
MSF F in G(1/2)
31
Random sampling.^ n
Obtain G(p) by independently including each edge with p = 1/2. n^
Let F be MSF in G(p). n^
Compute F-heavy edges in G. n^
Delete F-heavy edges from G. G
1
3
8
6 7
4
5
2
Random sampling lemma. Given graph G, let F be a MSF in G(p).Then the expected number of F-light edges is
n / p.
Proof.^ n
WMA c
1
c
2
c
m
, and that G(p) is constructed by flipping
coin m times and including edge e
if ii
th^
coin flip is heads.
n^
Construct MSF F at same time using Kruskal’s algorithm.^ –
edge e
added to Fi
e
is F-lighti
-^
F-lightness of edge e
depends only on first i-1 coin flips andi
does not change after phase i
n^
Phase k = period between when |F| = k-1 and |F| = k.^ –
F-light edge has probability p of being added to F – # F-light edges in phase k ~ Geometric(p)
n^
Total # F-light edges
p^
NegativeBinomial(n, p).