1 network optimization chapter 1 some graph theory concepts and trees

168
1 Network Network Optimization Optimization Chapter 1 Chapter 1 Some Graph Theory Co Some Graph Theory Co ncepts and Trees ncepts and Trees

Upload: brice-price

Post on 27-Dec-2015

223 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

1

Network OptimizationNetwork Optimization

Chapter 1Chapter 1Some Graph Theory ConSome Graph Theory Con

cepts and Treescepts and Trees

Page 2: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

2

•Graphs and digraphs A graph G = (V,E) consists of a finite set V

of vertices and a collection E of unordered pairs from V. Each pair in E is called an edge, denoted by e = {x,y}, x, y∈V. We say: x and y are adjacent, and e is incident to both x and y.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 3: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

3

u

v

x

w

y

G=(V,E)

V={u,v,w,x,y}, E={{u,v},{u,x},{v,w},{v,y},{x,w},{w,y}}

Page 4: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

4

x

y

A loop is an edge (directed or undirected) which starts and ends on the same vertex.

A simple graph is an undirected graph that has no loops and no more than one edge between any two different vertices. Any graph which is not simple is a multigraph.

A graph G’=(U’,V’) is a subgraph of the graph G =(U,V) if every vertex of G’ is a vertex of G and every edge of G is an edge of G, i.e. U’U and V’ V

Multigraph

x

Loop

Page 5: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

5

A directed graph (or digraph) D=(V,A) consists of a finite set V of vertices and a collection A of ordered pairs from V, and each pair is called an arc, which is expressed as a = (x,y). We say :

(i) a is an arc from vertex x to vertex y; (ii) a is incident from x; (iii) a is incident to y.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 6: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

6

u

v

x

w

y

D=(V,A), V={u,v,w,x, y}, A={(u,v),(u,x), (v,w), (v,y),(x,w),(w,y)}

The underlying graph G of a digraph D is the graph obtained from D by replacing each arc (x,y) by an edge {x,y}.

u

v

x

w

y

G is the underlying graph of D.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 7: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

7

• If, in a digraph D, there is no loop and at most one arc from any vertex x to another vertex y , then D is a simple digraph.

• If we associate one or more real numbers with each edge (or arc) of a graph (or a digraph), the resulting structure is called a network (or weighted graph).

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 8: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

8

•Connectivity A path in a graph is a sequence of vertices s

uch that between very two consecutive vertices there is an edge.

A path with no repeated vertices is called a simple path,

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

x1 x 2 x 3 X rx4 Xr-1……

e1 e2 e3 er-1

Page 9: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

9

A simple cycle (Hamilton cycle) is a cycle in which the vertices are all distinct. In a simple graph, if a cycle has k vertices, it must visit k edges; if k is even, the cycle is called an even cycle, otherwise it is an odd cycle.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 10: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

10

x3 =x 6, <x1,x2,x3,x4,x5

,x 6,x 7 >is not a simple path.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

x1

x 2

x 3x 4

x 6

x 5x1

x 2

x 3

x 4x 5

x 7

x 6

x1

x 2 x 3

x 4

x2 =x 5, < x1,x2,x3, x4, x 5,x 6,x 1>is a cycle, but not a simple cycle.

<x1,x2,x3,x4,x1> is an even cycle.

Page 11: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

11

• Two vertices x and y are connected if there is a path between them. A graph is a connected graph if each pair of vertices in the graph is connected.

• A connected subgraph H of the graph G is called a component of G, if vertices in H and vertices outside H are disconnected.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 12: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

12

G1 is a disconnected graph, and it has two components.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

x1

x 2 x 3

x 4x 5

x 6 x 7

G1

x1

x 2

x 3x 4

x 5

G2

x1

x 2

x 3x 4

x 5

G2

G2 is a connected graph, each pair of vertices in G2 is connected.

Page 13: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

13

• An edge e in a connected graph G is called a bridge if its deletion yields a disconnected subgraph.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

x1

x 2

x 3

x 4x 5

x 6

G

G is connected, and it has three bridges: {x1,x2},{x2,x3},{x3,x6}.

Page 14: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

14

• A directed path from vertex x1 to vertex xr in a digraph is a sequence x1, x2, …, xr, in which there is an arc from xi to xi+1 for i=1, …, r1. This path may be represented as x1→x2→…→xr.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

x1 x 2 x 3 X r……

a1 a2 a3ar-1

Page 15: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

15

• Two vertices x and y in a digraph form a strongly connected pair if there is a directed path from x to y and a directed path from y to x .

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

x1

x 2 x 3

x 4

D

In D, x1and x 4 form a strongly connected pair as there is a path x1→x2→x3→x4 and a path x4→x1.

Page 16: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

16

• A digraph is a strongly connected digraph if every pair of vertices is a strongly connected pair. A digraph is weakly connected if it is not strongly connected, but its underlying graph is connected.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

x1

x 2 x 3

x 4

A weakly connected digraph

x1

x 2 x 3

x 4

A strongly connected digraph

Page 17: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

17

• A simple path in a graph is called a Hamiltonian path if it passes through every vertex of the graph. A simple cycle is called a Hamiltonian cycle.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

x1

x 2

x 3x 4

x 5

G

x1

x 2

x 3x 4

x 5

G

In G, <x5,x1,x2,x3,x4>is a Hamiltonian path, <x1,x4,x3,x2,x5,x1>is a Hamiltonian cycle.

Page 18: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

18

•Bipartite graphs and complete graphs

If the set V of vertices of a graph G = (V,E) is partitioned into two subsets X and Y such that every edge in E is between a vertex in X and a vertex in Y, then the graph is called a bipartite graph and is denoted by G = (X,Y;E).

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 19: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

19

• A graph G = (V,E) is said to be complete if there is an edge between every pair of vertices. A bipartite graph G = (V,W;E) is complete if there is an edge between every vertex in V and every vertex in W.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 20: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

20

G1 is a bipartite graph; G2 is a complete graph with four vertices, and is denoted by K4; G3 =(X,Y;E) is a complete bipartite graph with |X|=2 and |Y|=3, and is denoted by K2,3.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

G1

X Y x1

x 2 x 3

x 4

G2

G3

X Y

Page 21: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

21

• Theorem 1.1 A graph with three or more vertices is bipartite if and only if it has no odd cycles.

• Proof :“ ” Let G=(X,Y;E) be a bipartite graph and C be a cycle in G. Obviously, C should have an even number of vertices which are alternatively in X and Y. Thus C must have an even number of edges, i.e., C is an even cycle.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 22: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

22

“ ” Suppose G=(V,E) has no odd cycle. Without loss of generality, assume G is connected. Let each edge have length 1, and denote by D(u,v) the length of the shortest path between vertices u and v, i.e., D(u,v) is the minimum number of edges needed to reach v from u.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 23: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

23

• Pick up an arbitrary vertex in G as u. Define X={x∈V: D(u,x) is even}, Y=VX.

• In order to show that G=(V,E) is a bipartite graph, we only need to show that whenever vertices v and w are both in X (or in Y), there is no edge in E joining v and w.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 24: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

24

• Such v & w have only three cases:case 1 v ∈ X and w=u (v ≠ u)case 2 v, w ∈ X, (v ≠ u, w ≠ u)case 3 v, w ∈ Y. We can see easily that they are all impossible. • Hence each edge in E must be between

one vertex in X and one vertex in Y. So G (V,E) = G (X,Y;E), i.e., G(V,E) is a bipartite graph.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 25: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

25

• Degrees, indegrees and outdegrees The number of edges incident to a vertex is

the degree of the vertex. A vertex of G is odd if its degree is odd. A vertex of G is even if its degree is even.

The degree of a vertex v in G=(V,E) is denoted by dG

(v) (or d(v)). Then

||2)( EvdGv

G

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 26: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

26

• In a digraph D=(V,A), the indegree of a vertex v is the number of arcs incident to v, denoted by d-(v);

• The outdegree of a vertex v is the number of arcs incident from v, denoted by d+(v).

• The degree of a vertex is the sum of its indegree and its outdegree.

|| )()( AvdvdGvGv

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 27: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

27

• Incidence matrices and totally unimodular matrices

Suppose G=(V,E), where V={ x1,x2,x3,…,xm} and E={e1,e2,…,en}.

The incidence matrix of the graph G is an mn matrix A =[aik], where each row corresponds to a vertex, and each column corresponds to an edge.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

othersise; 0

; xith vertexincident w is e edge if1 ikika

Page 28: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

28

• For a digraph D = (V,A), where V ={v1,…,vm} and A = {a1,…,an}, the incidence matrix is an mn matrix [aik] where

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

otherwise0

; vertex vfromincident is a arc if1-

; vertex voincident t is a arc if1

ik

ik

ika

Page 29: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

29

• Examples:

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

v2

v1 v4

v3

e4

e1

e2

e3

e5

v2

v1 v4

v3

a4

a1

a2

a3

a5

Page 30: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

30

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

• A matrix A with integer entries is called a totally unimodular matrix (TU) if the determinant of every square submatrix B of A is either 0,1 or -1.

• In fact, if A is a TU matrix and B is any nonsingular square submatrix of A, then the unique solution of the linear system Bx = C, where C is an integer vector, is xi = Pi / det (B) for all i.

• As each Pi is an integer, x must be an integer vector.

Page 31: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

31

• Theorem 1.2 Suppose every element of matrix A=[aij] is 0, 1 or -1. If

1. No column of A can have more than two nonzero elements; and

2. We can partition the set I of rows of A into sets I1 and I2 such that if aij and akj are two nonzero elements in column j, then row i and row k belong to the same subset of the partition if and only if aij and akj are of opposite signs, (one of the I1 and I2 may be an empty set) ,

then A is a totally unimodular matrix.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 32: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

32

• Remark: condition 2 means that the two nonzero element in a column can be partitioned as follows: if they are in the same set, they must be 1 and -1; and if they are in the different sets, they must be either 1,1 or -1,-1.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 33: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

33

• Proof : Let C be any kk submatrix of A, we need to show that det C = 0,1 or -1.

• We prove it by induction on k. If k=1, the theorem is obviously true.

• Suppose it is true for k1. We have to prove it is true for k. There are three possibilities:

(i) C has a zero column det C=0.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 34: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

34

(ii) C has a column with exactly one nonzero entry which could be either 1 or -1.

We expand along this column :

det C = det C , or = -det C where C is a (k-1)(k-1) submatrix, and

hence we know that det C = 0, 1 or -1. i.e., det C = 0, 1 or -1.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 35: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

35

(iii) Every column of C has exactly two nonzero elements. Suppose E = {r1, r2,…, rk } is the set of the rows of C. By condition 2, these k rows can be partitioned into two subsets I1 and I2, say I1 = { r1, r2,…, rp } , I2 = { rp+1,…, rk }

with the above mentioned property. It is known from the Remark that r1+r2+…+rp = rp+1+…+rk .

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 36: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

36

So, the rows of C are linearly dependent.

det C = 0.The proof is thus completed. • Corollary 1.3a A matrix in which

each element is 0 or 1 or -1 is totally unimodular if in each column there is at most one +1 and at most one -1.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 37: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

37

• The condition means that if there are two non-zero elements in a column, they must be 1 and -1. We may prove this corollary by applying Theorem 1.2 with I2 = Ø .

• A special case of this corollary is that A is the incidence matrix of a digraph, i.e. the incidence matrix of any digraph must be a TU matrix.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 38: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

38

• Corollary 1.3b The incidence matrix of any bipartite graph must be totally unimodular.

• Proof: Let the bipartite graph be G=(X,Y;E) and its incidence matrix be A. We let the rows of A corresponding to the vertices in X be I1; and other rows be I2. It must satisfy the conditions of Theorem 1.2.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 39: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

39

• Theorem 1.4 In a graph G, the following properties are equivalent:

• G is bipartite;• G has no odd cycle;• The incidence matrix A of G is TU.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 40: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

40

• Proof: So far we already know that (i) (ii) (Theorem 1.1) , and (i) (iii) (Corollary 1.3b).

• We only need to show that (iii) (ii), i.e., A is TU G has no odd cycle. We prove it by contradiction.

• Suppose G has an odd cycle. Without loss of generality, assume that the cycle consists of the vertices v1,v2,…,v2k+1, and the edges {v1,v2},{v2,v3},…, {v2k,v2k+1},{v2k+1,v1}.

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 41: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

41

• Let C be the (2k+1)(2k+1) submatrix of A corresponding to these vertices and columns:

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

Page 42: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

42

• Expanding by the first row,

1.1 Some graph theory 1.1 Some graph theory conceptsconcepts

211

1

11

11

11

11

11

11

1

det C

which is impossible (because A is TU). So, the theorem is proved.

Question: in which step of the above proof, we used the condition ‘odd cycle’?

Page 43: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

43

1.2 Spanning Trees1.2 Spanning Trees

•Forests and trees A graph which does not contain any cycle

is called an acyclic graph or a forest. A connected acyclic graph is a tree.

x1

x 2

x 3

x 4

x 5

x 6

forest

x 9x 7

x 8

x 10

x 11

x 7x 4

x1

x 2

x 3

x 5

x 6

tree

Page 44: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

44

Concepts used in the Concepts used in the following proofsfollowing proofs

• There are two different paths from a to b there is a cycle

• There is a cycle there are two vertices a and b, s.t. there are two path from a to b.

Page 45: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

45

1.2 Spanning Trees1.2 Spanning Trees

• Theorem 1.5 A graph G is a tree if and only if there is a unique simple path between every pair of vertices in the graph.

• Proof : “” If there is a unique path between every pair of vertices x and y, then G is connected and G contains no cycle. So G is a tree.

• “” Suppose G is a tree. Then G is connected. There is a path between every pair of vertices

x and y in the graph.

Page 46: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

46

1.2 Spanning Trees1.2 Spanning Trees

Such path between x and y must be unique. If not, let P & P be two paths between them. Then we use the figures below to see that G must contain a cycle, which is impossible. { vi , vi+1 } is the first edge in P, but not in P.

Page 47: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

47

1.2 Spanning Trees1.2 Spanning Trees• Theorem 1.6 A graph G is a tree if and only

if every edge is a bridge.• Proof: “” Suppose G is a tree. Consider

any edge e = { x, y } in G. By Theorem 1.5, there is a unique path between x and y. So, e = { x, y } is the unique path between x and y. So, if we delete the edge e, there is no path between x and y, i.e., x and y will not be connected e is a bridge.

Page 48: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

48

1.2 Spanning Trees1.2 Spanning Trees

• “ ” Suppose every edge in G is a bridge.

It means G is connected. If G contains a cycle, and e = { x, y } is an edge of the cycle, then e cannot be a bridge (why?), a contradiction is caused.

• So, G contains no cycle. G is a tree.

Page 49: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

49

A concept used in the A concept used in the following prooffollowing proof

• Any connected graph, |E| > |V| - 1.

Page 50: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

50

1.2 Spanning Trees1.2 Spanning Trees

• Theorem 1.7 (i) A connected graph with n vertices is a

tree if and only if it has n-1 edges.(ii) An acyclic graph with n vertices is a tree

if and only if it has n-1 edges.• Proof (i) “ ” Suppose G is a tree. We

prove by induction on n that G has n-1 edges. This is of course true when n=1.

Page 51: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

51

1.2 Spanning Trees1.2 Spanning Trees

• Suppose it is true for all m : 1<m<n. G is a tree any edge e={ x, y } is a bridge. So, if we delete e from G, we obtain two disconnected subgraphs H=(V,E) and H=(V,E). Say H has k vertices; H has k vertices. 1k<n, 1k<n and k+k=n.

• Since H and H are trees, H has k-1 edges, H has k-1 edges. As G= H H {e}, G has (k-1)+(k-1)+1 =k+k-1=n-1 edge, i.e. the conclusion holds when G has n vertices.

Page 52: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

52

1.2 Spanning Trees1.2 Spanning Trees

• “ ” Suppose G=(V,E) is a connected graph with n vertices and n-1 edges. We prove that G must be a tree.

• By theorem 1.6, if G is not a tree, then there is an edge e={ x, y } of G which is not a bridge. After deleting e, we still have a connected subgraph G=(V,E). However, it is impossible since ( E = E 1 = |V|-2).

• Proof (ii) “ ” Suppose G is a tree. Then by the proof of (i), G has n-1 edges.

Page 53: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

53

1.2 Spanning Trees1.2 Spanning Trees

• “ ” We only need to show that G is connected.

Suppose G is disconnected and has k components (k>1). Because G is acyclic, we know that each component of G is a tree. Let the number of vertices of the k components be n1, n2,…, nk, respectively. Then |E| = (n1-1) + (n2-1) +…+ (nk-1)=n-k < n-1, a contradiction.

• From Theorem 1.7 we have:

Page 54: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

54

1.2 Spanning Trees1.2 Spanning Trees

• Corollary 1.9 Let G=(V,E) be a simple graph with n vertices. If the graph G meets any two of the following three properties, then it must satisfy the third one also, and G is a tree.

1.G is connected;2.G is acyclic;3.G has n-1 edges.

Page 55: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

55

1.2 Spanning Trees1.2 Spanning Trees

• Spanning trees If a tree T = (V,F) is a subgraph of G =

(V,E), then T is a spanning tree of the graph G.

In word, a spanning tree T of G is a subgraph of G, which is a tree and contains all vertices of G.

• Theorem 1.8 A graph is connected if and only if it has a spanning tree.

Page 56: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

56

1.2 Spanning Trees1.2 Spanning Trees

• Proof “ ” obviously. “ ” we may start with any connected and

acyclic subgraph of G, i.e. a subtree of G, for example an edge {u,v} and the two vertices u and v.

Suppose this subgraph is H(V,E). If H already covers all vertices (i.e., V=V), it is a spanning tree. If not, let V=V-V. i.e., V is partitioned to V and V. Since G is a connected graph, there must be an edge e={x,y} with xV, yV.

Page 57: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

57

1.2 Spanning Trees1.2 Spanning Trees

Let H= H e {y}. H is still a tree.

If H includes all vertices, we are done; otherwise continue expanding H until it covers all vertices. Then it must be a spanning tree. The theorem is thus proved.

Page 58: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

58

1.2 Spanning Trees1.2 Spanning Trees

• In a connected graph G(V,E), starting from any vertex, we can visit all other vertices by one of the following two ways:

• breadth-first search (BFS)• depth-first search (DFS)

Page 59: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

59

1.2 Spanning Trees1.2 Spanning Trees

v0

v1 v2

v11 v12 v21 v22

v111 v112 v113

BFS

v1 v7

v2 v6 v8 v9

v3 v4 v5

v0

DFS

v1

Page 60: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

60

1.2 Spanning Trees1.2 Spanning Trees

For the graph below, we may use BFS or DFS to visit all vertices, and to obtain BFS spanning tree or DFS spanning tree, both rooted at v0.

G

Page 61: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

61

1.2 Spanning Trees1.2 Spanning Trees

BFS to visit all vertices, and to obtain BFS spanning tree, rooted at v0.

G

Page 62: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

62

1.2 Spanning Trees1.2 Spanning Trees

DFS to visit all vertices, and to obtain DFS spanning tree, rooted at v0.

G

Page 63: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

63

1.2 Spanning Trees1.2 Spanning Trees

• Disconnecting sets and cutsets • A subset D of E is a disconnecting set

if the deletion of all the edges in D will increase the number of components.

• A disconnecting set D is a cutset if no proper subset of D is a disconnecting set.

Page 64: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

64

1.2 Spanning Trees1.2 Spanning Trees

In the above graph, {1,2,1,4,1,3,2,5} is a disconnecting set, but not a cutset.

G

Page 65: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

65

1.2 Spanning Trees1.2 Spanning Trees

• Suppose the set V is partitioned into two subsets X and Y. We define D=(X,Y) to be the set of all edges in E of the form {x,y}, where xX and yY. Obviously, D must be a disconnecting set, but need not be a cutset.

In the graph, X={1,2}, Y={3,4,5,6,}, D={{1,3}, {1,5}, {2,5}}is not a cutset, because its proper subset {{2,5}} is also a disconnecting set.

3

1 4

5

2 6

Page 66: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

66

1.2 Spanning Trees1.2 Spanning Trees

• Theorem 1.10 A disconnecting set D=(X,Y) in a connected graph G=(V,E) will be a cutset if G=(V,ED) has exactly two connected components.

(Note that in the previous example on Page 65, after

deleting D, we obtain three, not two, components.)

Proof: We prove the theorem by contradiction. If D is not a cutset, then there is a proper subset D which is still a disconnecting set.

Page 67: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

67

1.2 Spanning Trees1.2 Spanning Trees

• Let e=(x,y) DD where xX, yY. If we delete the edges in D, e would still be in the remaining graph.

• Since G=(V, ED) has two connected components, all vertices in X must be connected in G, and all vertices in Y must be connected in G, too.

• So, for any vX and wY, there is a path P between v and x passing through vertices exclusively from X, and there is a path Q between y and w passing through vertices exclusively from Y.

Page 68: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

68

1.2 Spanning Trees1.2 Spanning Trees

• As e={x,y} is not deleted, v and w are connected via the path P U {e} U Q. This means D is not a disconnecting set. So, we derive a contradiction, and the theorem is proved.

Page 69: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

69

1.2 Spanning Trees1.2 Spanning Trees

• Corollary 1.11 If e is any edge of a spanning tree T in a connected graph G, the deletion of e from T defines a partition of the set of vertices of T (and therefore of G) into two subsets X and Y such that D = (X,Y) is a cutset of the graph G.

• This corollary is easy to understand by Theorem 1.10, because the deletion of D results in two connected components.

Page 70: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

70

1.2 Spanning Trees1.2 Spanning Trees

Example :

Page 71: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

71

1.2 Spanning Trees1.2 Spanning Trees

• From this corollary we know that corresponding to each edge e in a spanning tree T of a connected graph G, there is a unique cutset, called the fundamental cutset of T with respect to the edge e which is denoted by DT(e), or by D(e) if the tree T is fixed beforehand.

Page 72: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

72

1.2 Spanning Trees1.2 Spanning Trees Let e = {x,y} be a chord of T. The unique cycle

in G consisting of the edge e and the edges of the unique path in T between x and y is called the fundamental cycle of G relative to T with respect to e, and is denoted by CT(e), or by C(e)

if the tree T is fixed beforehand.

Page 73: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

73

1.2 Spanning Trees1.2 Spanning Trees

So, given a spanning tree T, for each edge in T, we can define a fundamental cutset; and for each edge not in T, we define a fundamental cycle.

If the graph G has n vertices and m edges, then each spanning tree T has n-1 edges, and the other m-n+1 edges are chords of T. So, using this tree, we define n-1 fundamental cutsets and m-n+1 fundamental cycles.

Page 74: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

74

1.2 Spanning Trees1.2 Spanning Trees

• Theorem 1.13 Let e be an edge of a spanning tree T in a graph, and f be any edge (other than e) in the fundamental cutset D(e) defined by e. Then

1. f is a chord of T and e is an edge of the fundamental cycle C(f) defined by f; and

2. if e is any chord of T, not in D(e), then e is not an edge of the fundamental cycle C(e).

Instead of a rigorous proof, we use an example to explain the theorem.

Page 75: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

75

1.2 Spanning Trees1.2 Spanning Trees

x1

x 2

x 3

x 4x 5

x 6

G

e

f

e’

Spanning Tree T: bold lines

D(e): {e, f}.

f in D(e), but e’ not in D(e).

C(f): {e, f, {x3, x4}}

C(e’): {e’, {x3, x6}, {x3, x4}}

We see that:

e is in C(f), but e is not in C(e’).

Page 76: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

76

1.2 Spanning Trees1.2 Spanning Trees

• Theorem 1.14 Let e be a chord of a spanning tree T in a graph and f be any edge (other than e) in the fundamental cycle C(e) defined by e. Then

• f is an edge of T and e is an edge of the fundamental cutset D(f) defined by f; and

• if e is any edge of T, not in C(e), then e is not an edge of the fundamental cutset D(e).

Page 77: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

77

1.2 Spanning Trees1.2 Spanning Trees• At the end of this section, we give

another property of a disconnecting set, which will be used in the next section.

• Theorem 1.12 In a graph G=(V,E) let C be a cycle and D be a disconnecting set of the form (X, Y), where X is a subset of V and Y=V-X. Then C D must contain an even number of edges;

Page 78: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

78

1.2 Spanning Trees1.2 Spanning Trees

Proof Let D = (X,Y). If all vertices of C are in X, then none of the edges of C are in D. So, the number of edges in

C D is 0, which is an even number. It is also the case if all vertices of C are in Y.

Page 79: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

79

1.2 Spanning Trees1.2 Spanning Trees

The remaining case is that C has a vertex x in X and a vertex y in Y. Say the circle C starts at x and ends at x, and there are intermediate vertices in Y. Therefore, cycle C must use the edges of D an even number of times.

Page 80: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

80

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• If each edge e of a graph G = (V,E) is assigned a real value w(e), called the weight of e, then we say the graph is a weighted graph or a network.

• If H is a subgraph of a weighted graph, the weight of H is the sum of the weights of all the edges of H and is denoted by w(H).

Page 81: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

81

• A spanning tree T in a connected network is a minimum weight spanning tree or minimum spanning tree (MST) if there is no other spanning tree T such that w(T)<w(T).

• We define maximum weight spanning tree T of a connected graph G similarly: if for every spanning tree T of G, w(T) ≦ w(T).

1.3 1.3 Minimum WeightMinimum Weight Spanning Spanning TreesTrees

Page 82: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

82

• MST problem has many applications Example A: A university has 5 computer labs

and these 5 labs need to be interconnected by underground cable. What is the minimum length of cable required?

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

The cable should reach all vertices (labs). To shorten the length of cable, no cycle is allowed. So, this is a minimum spanning tree problem, where the weight of each edge is its length.

Page 83: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

83

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Example B Grouping technologyA factory produces n parts using m machines, and we a

re given an mxn machine-part incidence matrix A for which aij = 1 if part j must be processed by machine i, and 0 otherwise. Suppose all machines have to be grouped into k sets (may be put into k rooms), and it is desirable that the machines in a group process the same kinds of parts, or at least process as much common parts as possible. This is called machine grouping problem.

Page 84: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

84

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Let be the set of parts that require processing by machine i. For any two machines, i and k, define a distance measure d(i,k) as follows:

Here the numerator is the symmetric difference, namely t

he number of parts requiring processing only on ONE of the two machines (either on machine i, or on machine k, but not both). The denominator is the number of parts requiring processing on either machine or both.

iM

||

||),(

ki

ki

MM

MMkid

Page 85: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

85

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

The distance is a measure of the relative dissimilarity of the two machines with respect to their parts processing requirements.

d(i,k)=0 means that the two machines have exactly the same set of parts to process;

d(i,k)=1 means that they process no parts in common;and generally, the smaller the value d(i,k), the more sim

ilar the part ranges of the two machines. So, if d(1,2)=0.8 and d(1,3)=0.3, it is more reasonable to group machine 1 with machine 3, not with machine 2.

Page 86: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

86

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Now we may create a complete graph G=(V,E) in which each machine is represented by a vertex (e.g. vertex 5 stands for machine 5), and draw an edge between each pair of vertices. For edge {i, j}, we defines its weight as d(i,j).

As we want the overall weight to be as small as possible, we find a minimum weight spanning tree T.

If we delete one edge from T, we obtain two trees; delete two edges, obtain three trees; ……

Page 87: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

87

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

As we need to group all machines to k sets and let their overall weight small, we delete k-1 edges from T which have the largest k-1 weights. The result is a forest of k trees, and each tree represents a group of machines.

For the following example, there are 9 machines for parts 1-13. If we wish to form three machine groups (k=3), we should remove the two largest weight edges, i.e., {1,3} and {4,5}, from the obtained minimum spanning tree. The resulting 3 connected components (trees) would consist of the vertices {1,2,5}, {3,9} and {4,6,7,8}.

Page 88: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

88

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

1 1 1 1 1 1 1

1 1 1 1 1

1 1

1 1 1

1 1 1 1 1 1

1

1 1

1 1

1

1

2

3

4

5

6

7

8

9

1 2 3 4 5 6 7 8 9 10 11 12 13

Machine-part incidence matrix

Page 89: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

89

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• FROM 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 5 5 5 5 6 6 6 7 7 8

• TO 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9

• COST 0.5, 1, 0.89, 0.14, 1, 1, 1, 1, 1, 1, 0.62, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 0.87, 0.67, 0.75, 0.75, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1

Network parameters for the group technology problem --NETSOLVE

listing

Page 90: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

90

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• TOTAL COST OF MINIMUM SPANNING TREE: 4.43

• EDGES IN THE MINIMUM SPANNING TREE• FROM TO COST 1 2 0.50 1 3 1.00 4 5 0.87 1 5 0.14 4 6 0.67 4 7 0.75 7 8 0.00 3 9 0.50

NETSOLVE output for the minimum spanning tree solution

Page 91: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

91

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Minimum spanning tree for the group technology example

Page 92: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

92

• Theorem 1.15 A spanning tree T in a weighted graph is a minimum spanning tree (MST) if and only if every edge in T is a minimum weight edge in the fundamental cutset defined by that edge.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 93: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

93

• For example, check if T is a MST? • Consider e={4,3}T. D(e)= {{5,1},{5,2},

{5,3},{4,1},{4,3}}, w(e)= {2, 2, 2, 6, 5}. Since e is not the minimum weight edge in D(e), T is not an MST.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 94: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

94

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• To prove the theorem, we use the example to explain the “only if part” of the theorem. Here {5,1} (and also edges {5,2} & {5,3}) has a smaller weight than edge e={4,3}. By Th.1.13, {5,1} is a chord of T (i.e., not in T). If we consider

T’ = T – {4,3} + {5,1}, T’ would be a spanning tree with less weight:

w(T’) <w(T). So, T is not a MST.

Page 95: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

95

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• Proof of the “if part”: Suppose T is a spanning tree and each edge in T is a minimum weight edge in its fundamental cutset.

• Let T’ be an MST, and we need to show that w(T)=w(T’).

• If T=T’, we are done.• Consider T≠T’, and suppose k edges of T are not

in T’ (k≧1).• Let edge e T-T’. Then . (e)C(e)De T'T

Page 96: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

96

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• As | DT(e) CT’(e) | must be an even number, there is

• As f is in DT(e), by the assumption, w(e)≦w(f).• If w(e) < w(f), then T’’ = T’–f+e is another spa

nning tree with w(T’’)=w(T’)-w(f)+w(e)<w(T’)

which is against the assumption that T’ is a MST. So, w(e)=w(f).

. , )( )( ' efeCeDf TT

Page 97: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

97

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• Let T1 =T+f-e. We have w(T)=w(T1), and the number of different edges between T1 and T’ is k-1.

• Repeat the procedure for k times, at last we obtain a spanning tree such that Tk = T’, and w(T)=w(Tk)=w(T’). This means that T is a MST.

Page 98: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

98

• Theorem 1.17 A spanning tree T in a graph is a minimum spanning tree if and only if every chord of the tree is a maximum weight edge in the unique fundamental cycle defined by that edge.

• Proof “ ” Let T be an MST. If a chord e is not the maximum weight edge

in C(e), then there is fC(e) with w(e)<w(f).

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 99: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

99

• “ ” Let T be a spanning tree satisfying the given condition. Let f be any edge in T. For each edge e D(f) (e ≠ f), as e is a chord of T (due to Th. 1.13), e is the maximum weight edge in C(e).

But fC(e) (again, by Th. 1.13). So, w(e) w(f). f is the minimum weight edge in D(f), i.e. the optimality condition of Th.1.15 holds. T is an MST.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Consider the spanning tree T=T+e-f. w(T)<w(T) T is not MST, a contradiction!

Page 100: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

100

• Theorem 1.19 Let T be an MST in G=(V,E) and H be a subgraph of T. Let V be the set of vertices of a component of H. If e is the minimum weight edge in the disconnecting set D=(V,V-V), then there exists an MST of G which contains:

1) e as an edge, and 2) H as a subgraph.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 101: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

101

• Proof If eT, then T is just such an MST. So, assume e T. T+{e} has a cycle C and e C ∩ D. Since C ∩ D is even, C ∩ D has another edge f (f ≠ e). As e is an minimum weight edge in D,

w(e) w(f) (A) Since every edge in C other than e is in T, we

know that fT. Consider the fundamental cutest D(f). Since

fC∩ D(f) and C ∩ D(f) is even, there is another edge, say e, in C∩D(f) and e ≠ f.

1.3 Minimum Weight Spanning Trees1.3 Minimum Weight Spanning Trees

Page 102: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

102

As there is only one edge f in T in the set D(f), so e must be in C, but not in T. However, the only edge in C-T is e. So, e = e, and hence eD(f). As T is an MST and fT, by Th 1.15,

w(f) w(e) (B) (A) and (B) mean w(f)=w(e).

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 103: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

103

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 104: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

104

Consider T* = T-{f}+{e}. T* is still a spanning tree of G. As w(T*)=w(T), T* is an MST.

1) T* contains e; 2) T* contains the subgraph H of T (because the only

part of T which does not belong to T* is the edge f, but f is not in H).

So, the theorem is proved.

This theorem gives us a procedure for constructing an MST from a known subgraph of the MST.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 105: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

105

• Two algorithms for finding MST • Kruskal’s algorithm(suppose the

network has n vertices)• Step 1 Arrange the edges by their

weights in non-decreasing order in a list L and set T to be the empty set.

• Step 2 Add the first edge in L to T.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 106: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

106

• Step 3 If every edge in L is examined, stop and report that G is not connected. Otherwise take the first unexamined edge in L and include it in T if it does not form a cycle with the edges already in T. If the edge is added to T, go to Step 4, otherwise repeat Step3.

• Step 4 Stop if T has n-1 edges. Otherwise go to Step 3.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 107: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

107

• Example 1.1 The network is shown below :

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 108: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

108

• The list of edges with non-decreasing weights is L={{1,2},{3,4},{1,8},{4,5},{7,8},{2,7},{5,6},{3,6},{5,8},{6,7},{2,3},{1,4}}

• Then we use Steps 2-4 to obtain an MST.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 109: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

109

• Justification of the algorithm• If the graph is connected, it must have a

spanning tree (Th.1.8). So, in the process, L should have enough edges to form a spanning tree. Every spanning tree has n-1 edges which do not form a cycle. So, if T has less than n-1 edges, but L has no more unexamined edges to be added to T, the graph must not be connected.(Algo. returns no solution NO solution)

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 110: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

110

* If the above empty-L case does not happen, then at last T contains n-1 edges and is acyclic. Therefore, T is a spanning tree.

* For any chord e of T, as it is not selected to the spanning tree T, according to the selection rule of the algorithm, for any edge f in the fundamental cycle C(e), it must be w(e) ≥w(f).

• So, by Th.1.17, T must be an MST.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 111: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

111

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• Computer Implementation of the Kruskal’s Algorithm

• When we use computer to run the algorithm, in Step 3 how to check “it does not form a cycle”?

• When the edges are assigned to the tree in the process, they form one or more connected components. We call the set of vertices belonging to a connected component a bucket, and a unique number is assigned to each bucket and hence to all the vertices in the bucket, say bucket 1, 2, …

Page 112: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

112

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• An edge forms a cycle with the edges already assigned to the tree if and only if both its endpoints are in the same bucket – this is an easy to check if a cycle would be formed.

• So, an edge can be assigned to the tree only if the two endpoints do not belong to the same bucket. In this case, we let the two buckets merge into one. (because the two components are now connected)

• The algorithm terminates when all vertices are in one bucket.

Page 113: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

113

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• Kruskal’s algorithm for computer useStep 1. Arrange all edges by their weights in a no

n-decreasing order. Assign the first edge to the tree, and place its both endpoints in an empty bucket.

Step 2. Examine the next edge (if no such edge exists, then stop as no spanning tree exists.) One of the four situations must occur:

Page 114: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

114

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

(a) Both endpoints of this edge are in the same bucket – reject this edge and return to the beginning of Step 2 (i.e., examine the next edge);

(b) One endpoint is in a bucket, and the other endpoint is not in any bucket - assign the edge to the tree, and place the unbucketed endpoint in the same bucket as the other endpoint;

Page 115: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

115

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

(c) Neither endpoint is in any bucket – assign the edge to the tree and place both endpoints in an empty bucket (i.e., create another connected component);

(d) The two endpoints are in two different buckets – assign the edge to the tree and combine the vertices of both buckets in one bucket, leaving the other bucket empty.

Page 116: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

116

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Step 3. If all the vertices of the graph are in one bucket, or if the number of the assigned edges equals the number of vertices less one, stop; otherwise return to Step 2.

Page 117: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

117

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• We re-calculate Example 1.1 by this revised algorithm. Examine each edge by the order given previously and fill the result in the following table:

Edge Assigned? Bucket 1 Bucket 2{1,2} yes 1,2 empty{3,4} yes 1,2 3,4{1,8} yes 1,2,8 3,4{4,5} yes 1,2,8 3,4,5{7,8} yes 1,2,8,7 3,4,5{2,7} no 1,2,8,7 3,4,5{5,6} yes 1,2,8,7 3,4,5,6{3,6} no 1,2,8,7 3,4,5,6{5,8} yes 1,2,8,7,3,4,5,6 emptyWe stop as all vertices of the graph are in the same bucket and n-

1=8-1=7 edges are assigned. The solution is the same as before.

Page 118: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

118

• Prim’s algorithm • Step 1. Select an arbitrary vertex of G

and include it in T.• Step 2. Let V be the set of all vertices

of G and W be the set of vertices in T. Find an edge of minimum weight in the disconnecting set (W,V-W) and add it to T. If (W,V-W) is an empty set, stop and report that G is not connected.

• Step 3. Stop if T has n-1 edges. Otherwise repeat Step 2.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 119: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

119

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• Justification of Prim’s algorithm* If G is connected, then it must have a

spanning tree. So (W,V-W) should be non-empty until n-1 edges are selected. In other words, if (W,V-W)=Ø when T< n-1, it means G is not connected.

* When T =n-1, as by the algorithm, the T must be connected, we know that T is a spanning tree.

Page 120: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

120

* When T is expanded, we always choose the minimum weight edge e in (W,V-W) and adjoin this edge to T. So, by Th1.19 and Mathematical induction, the new tree much be contained in a MST provided that the old tree is contained in a MST

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 121: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

121

• Prim’s algorithm in matrix form• Suppose graph G=(V,E) has n vertices.

Define an nn matrix D=[d(i,j)], where

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Gin j}{i, edge no is thereif,

exists j}{i, edge ifj},edge{i, theofweight ijd

Note that d(i,j)=d(j,i).

Page 122: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

122

• Initial step: choose one vertex, say vertex i, delete the i-th column from D and put a check mark√ beside row i (in the example below, choose i=1). At this stage, no entry of D is circled.

• Iterative steps:• Step 1. Select a smallest element from

the uncircled entries in the rows which are checked. If there is no element to select in these rows except the entries, stop with the conclusion that G is not connected.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 123: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

123

• Step 2. If d (i,j) is selected in step 1, circle that entry and check row j with a check mark. Delete the remaining elements in column j. If all rows are checked, stop and the edges corresponding to the circled entries form an MST, otherwise go to Step 1.

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 124: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

124

• Example 1.2 Let us consider the network given in Example 1.1. The initial matrix is:

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

D=

1415

141514

151414

151413

1312

141216

1416

131612

In this matrix all entries in column 1 are deleted and row 1 is checked. At this stage no entry is circled.

Page 125: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

125

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

• Iteration 1• The smallest uncircled entry in the checked row is

d(1,2)=12. This element is circled, the remaining entries in column 2 are deleted and row 2 is checked, giving the matrix

Page 126: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

126

• Iteration 2• The smallest uncircled entry in the checked rows

is d(1,8)=13. This element is circled, the remaining entries in column 8 are deleted and row 8 is checked, giving the matrix

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 127: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

127

• Iteration 3• The smallest uncircled entry in the checked

rows is d(2,7)=14. This element is circled, the remaining entries in column 7 are deleted and row 7 is checked, giving the matrix

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

. . .

Page 128: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

128

• Iteration 7• The smallest uncircled entry in the checked

rows is d(4,3)=12. This element is circled, the remaining entries in column 3 are deleted and row 3 is checked, giving the final matrix

1.3 Minimum Weight Spanning 1.3 Minimum Weight Spanning TreesTrees

Page 129: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

129

• Let G=(V,E) be a connected graph . Hamiltonian cycle (H-cycle) is a cycle that passes through every vertex of G exactly once (except the “starting point” and the “endpoint” which coincide).

• If G is a weighted graph and has H-cycles, the H-cycle with minimum weight is called an optimal H-cycle.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 130: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

130

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• Let G=(V,E) be a connected graph . An Eulerian circuit is a circuit that passes through every edge of G exactly once.

Page 131: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

131

• Traveling Salesman Problem (TSP) is to find an optimal H-cycle in a connected network if the graph has H-cycles

• When the graph has no H-cycle, it is often that the requirement to pass through every vertex “exactly once” is related to “at least once”.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 132: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

132

• TSP is a difficult problem (called an NP-hard problem). It is unlikely to have a polynomial order algorithm, i.e., in the worst case, the time for finding an optimal H-cycle perhaps has an exponential order with respect to the number of vertices. So, for large TSP, it is very time consuming, or even impossible, to obtain an exact optimal solution.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 133: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

133

• Lower bound for the weight of the optimal H-cycle:

• Let C be an optimal H-cycle of a connected network G. If we delete one edge from C, we obtain a spanning tree, say T. Obviously, w(T) ≤w(C).

• Suppose T’ is an MST of G. Then w(T’) ≤ w(T) ≤ w(C) . (***)• So, the weight of any MST provides a lower

bound for the weight of the optimal H-cycle.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 134: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

134

• A better lower bound for TSP• Suppose graph G=(V,E) has n vertices

v1,…,vn. Let C be the optimal H-cycle. • If we remove one vertex, say v1, and the

two edges incident to v1, say e and f, from C, what remains is a spanning tree Tn-1 for the graph G’=(V’,E’), where V’=V-{v1} , E’=E-{all edges incident to v1} .

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 135: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

135

Let T’ be an MST of G’. Then w(Tn-1) w(T’ ) .But w(C)=w(Tn-1)+ w(e)+w(f) w(T’)+w(e)+w(f). Generally, we don’t know

what arcs are e and f.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 136: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

136

But w(e)+w(f) min {w(p)+w(q)|p,q are any

two edges incident to v1 }

So, w(C) w(T’)+ , i.e., w(T’)+ provides a

lower bound for the weight of the optimal H-cycle.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

def

Page 137: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

137

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• A further improved lower bound can be obtained by trying every vertex.

For i=1,…,n, let Vi’=V-{vi}, Ei’=E-{all arcs incident to vi} .

• Find a MST Ti’ in Gi(Vi’,Ei’) and =min{w(p)+w(q)| p,q are two edges incident to vi}

Let = max{w(Ti’)+ | i=1,…,n }. Then is a lower bound of w(C ).

• This method can obtain a better lower bound, but it needs much more computation.

i

i

Page 138: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

138

• We introduce several heuristic methods if the network

(1) is complete (i.e. there is an edge {vi,vj} between every pair of vertices vi and vj)

(2) has triangle property w(vi,vk) w(vi,vj)+w(vj,vk), vi,vj,vk G

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 139: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

139

• Method 1 (The Nearest Neighbor Method) (suppose the graph has n vertices)• Step 1 Choose any vertex as the initial

vertex, denote it by v1. Let k=1.• Step 2 For k=1,2,…,n-1, let the path

Pk=v1-v2-…-vk, and from the vertices not in Pk find the one closest to vk. Denote the vertex by vk+1.

• Step 3 Take v1-v2-…-vn-v1 as the approximate optimal H-cycle.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 140: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

140

• This is the easiest method. However, the error can be very large.

• In fact, let w(Copt) be the weight of the optimal H-cycle, w(C’ ) be the weight of the cycle obtained by the method. Then, it is proved that for any value r>1, there exists a network such that w(C’ )>r w(Copt).

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 141: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

141

• Method 2 (The Closest Insertion Method)• Step 1 Choose any vertex to form the initial

cycle C1 that contains only this vertex. Denote it by v1. Let k=1.

• Step 2 For k=1,2,…,n-1, from the vertices not in Ck find the vertex (say vk+1) to be the closest to a vertex (say, vi) in Ck. Let Ck+1 be the new cycle obtained by inserting vk+1 to Ck (either prior to, or after, vi).

• Step 3 Take Cn as the approximate optimal H-cycle.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 142: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

142

• Remark Suppose in Ck the vertices prior

to and after vk are, respectively, va and vb.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

If we put wk prior to vk, the total weight is increased by d1=w(va,wk)+w(wk,vk)-w(va,vk).If we put wk after vk, the total weight is increased by d2=w(vk,wk)+w(wk,vb)-w(vk,vb). We may decide the order between vk and wk by the values of d1 and d2, i.e., if d1 d2, put wk prior to vk; if d1>d2, put wk after vk.

Page 143: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

143

• Example 1.4 Let the weight matrix of a complete graph with 5 vertices be

[w(i,j)]= , V={1,2,3,4,5}.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

05457

50142

41033

54303

72330

Page 144: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

144

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• Method 1

The approximate optimal H-cycle C=1-4-3-2-5-1w(C )=2+1+3+5+7=18

143251C5 vertex ~Cin not & 2 vertex closest to

14321C2 vertex ~Cin not & 3 vertex closest to

1431C3 vertex ~Cin not & 4 vertex closest to

141C4vertex ~Cin not & 1 vertex closest to

11C1 vertex start with

54

43

32

21

1

05457

50142

41033

54303

72330

Page 145: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

145

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• Method 2• Start with C1 = 1-1 vertex 1

• Closest to ~ vertex 4 C2 = 1-4-1 vertex 1 & not in C1 w(1,4)=2

• Closest to ~ vertex 3 C3=1-3-4-1 vertex 1 or (or 1-4-3-1) 4 & not in C2 w(4,3)=1

05457

50142

41033

54303

72330

Page 146: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

146

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• Closest to ~vertex 2 C4=1-2-3-4-1 vertex 1,4, (or 1-3-2-4-1) or 3 & not in C3 w(3,2)=3 • Closest to ~ vertex 5 C5=1-2-5-3-4-1 vertex 1,4, (or 1-2-3-5-4-1) 3, or 2 & not in C4 w(3,5)=4

• C5 is the approximate optimal H-cycle. w(C5)=3+5+4+1+2=15.

05457

50142

41033

54303

72330

Page 147: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

147

• Method 3• Step 1 Find a minimum spanning tree T in

the graph G=(V,E).• Step 2 Duplicate every edge of T to obtain

a multi-graph H=(V,F), where F consists of all edges of T and their duplications. (i.e., each edge of T becomes two edges)

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 148: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

148

• Step 3 Obtain an Eulerian circuit U in H=(V,F) (U includes all edges of H once)

• Step 4 Change U to an H-cycle C by allowing every vertex to appear for only once.

• (For example. If U has a piece a-v-v’-b, but v and v’ already appeared before vertex a, then we use edge {a,b} to replace the above piece.)

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 149: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

149

• Example :• Step 1 Suppose

the MST is T.• Step 2 Duplicate

all edges of T.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Step 3 Eulerian circuit U=<1, 2, 3, 2, 4, 6, 5, 7, 5, 6, 8, 10, 9, 10, 8, 6, 4, 2, 1>.

Page 150: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

150

• Step 4 Approximate optimal H-cycle C=<1, 2, 3, 4, 6, 5, 7, 8, 10, 9, 1>.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Why do we duplicate all edges?

The reason is to guarantee the existence of Eulerian circuits.

Page 151: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

151

• Euler proved that a graph H has Eulerian circuit if and only if

(a) H is connected, and (b) the degree of each vertex is even.• By duplicating all edges, condition

(b) is satisfied, and thus H must have an Eulerian circuit U.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 152: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

152

• Theorem 1.20 The weight of the H-cycle obtained by Method 3 is less than twice the weight of the optimal H-cycle.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• Proof By the triangle property, w(C ) w(U),

where C and U are obtained by the algorithm. But w(U)=2w(T) 2w(COPT), where COPT is the optimal H-cycle (see page 125, inequality (***). Therefore, w(C) 2w(COPT).

Page 153: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

153

• Is it possible that this method can achieve a better upper bound? For example, can we prove that in any case,

w(C ) ≤ 1.9w(COPT)?• No! In fact we have an example below to show that the best upper b

ound for Method 3 is 2·w(COPT).

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 154: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

154

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 155: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

155

• According to graph (b), the Eulerian circuit is U=<a1, b1, b2, b3,…, bn-1, bn, an, bn, bn-1,

an-1, bn-1, bn-2, an-2, bn-2,……,b2, a2, b2, b1, a1>, thus C=<a1, b1, b2, …, bn, an, an-1, …,a2,’a1>.

• It is easy to calculate that w(C)=2(n-1)(2R+c)sin +2c

w(COPT)=n(2R+c)sin +nc

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

n

n

Page 156: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

156

• If R=1, c= , then w(C )=2(n-1)(2+ )sin + w(COPT)=n(2+ )sin + . When n→ , w(C)→4, w(COPT)→2. So, →2.

• In other words, when n is large, w(C) shall be very close to 2w(COPT).

• We may simplify the operations of Method 3 and obtain the following method.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

2n1

n

2n1

2n2

2n1

n

n1

)w(Cw(C)

opt

Page 157: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

157

• Method 4• Step 1 Find a minimum spanning tree T

in the graph.• Step 2 Conduct a depth-first search of

the vertices of T.• Step 3 If the order in which the vertices

appear in the search is v1, v2,…, vn, then the H-cycle v1-v2-v3-…-vn-v1 is the approximate solution.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 158: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

158

We still use the previous example to understand this method.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

A DFS may arrange the vertices as: 1, 2, 3, 4, 6, 5, 7, 8, 10, 9So, the approximate optimal H-cycle is C=<1, 2, 3, 4, 6, 5, 7, 8, 10, 9, 1>Which is the same as before.

Page 159: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

159

The solution is not unique. In fact we can also use DFS to obtain another H-cycle:

C’=<1, 2, 3, 4, 6, 8, 10, 9, 5, 7, 1>Question: Does C’ still meet the condition w(C’) 2w(COPT)?

In fact Theorem 1.20 isalso true to Method 4.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 160: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

160

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• Example 1.5• Obtain a low weight (i.e., approximate

optimal) H-cycle in the complete graph of Example 1.4 using Method 4.

• First, we can use the Prim’s method in matrix form to obtain an MST, T={{1,2},{1,4},{4,3},{3,5}}

• We may imagine a graph of T:

05457

50142

41033

54303

72330

Page 161: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

161

• If we conduct a DFS starting with vertex 4, then the order of the vertices can be 4, 1, 2, 3, 5.

• So, a low weight H-cycle is C’=4-1-2-3-5-4. • And the weight is w(C’)=2+3+3+4+5=17.• Note that we may also solve this problem by

Method 3.• We now consider the error estimate for Method

2.

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 162: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

162

• Theorem 1.21 The weight of the H-cycle obtained by Method 2 is not more than twice the weight of the optimal H-cycle.

• Proof The key idea of the following proof is to notice the similarity between this method and the Prim’s method for obtaining an MST.

• Let Ck be the cycle with k vertices constructed by Method 2. From the method, we know that

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 163: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

163

Ck+1 is obtained from Ck by adding edges {wk, vk} and {wk, vi} and deleting the edge {vk, vi} (suppose vi is the vertex in Ck prior to vk): Ck+1=Ck+{wk, vk}+{wk, vi}-{vk, vi} .

• Let T1 = {v1}, and for k=1,2,…, let Tk+1 be the tree obtained from tree Tk by adding edge {wk, vk}:

Tk+1=Tk+{vk, wk} .

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Page 164: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

164

• We now prove w(Ck) 2w(Tk) (*)

by introduction.• For k=2, obviously w(C2)=2w(T2).

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• Here {vk, wk} has the minimum weight among all the edges connecting a vertex in Ck and a vertex not in Ck. So, by Prim’s algorithm, Tk is an MST connecting all vertices in Ck.

Page 165: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

165

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• Generally, if the inequality is true for k, we show that it also holds for k+1. By the triangle property, w{wk, vi} w{wk, vk}+w{vk, vi} .

We have w(Ck+1)=w(Ck)+w(wk,vk)+w(wk,vi)-w(vk,vi)

w(Ck)+2w(wk,vk) 2w(Tk)+2w(wk,vk)

=2w(Tk+1).• So, the inequality (*) holds for all k=2, 3,…, n.

Page 166: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

166

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• But Cn is the H-cycle obtained by Method 2, and Tn is the MST of the graph G. Thus we obtain

w(Cn) 2w(Tn) 2w(COPT). The theorem is hence proved.• As we have seen, Methods 2-4 all only

guarantee that the constructed H-cycle C satisfies the condition w(C) 2w(COPT).

• There are better methods. For example, one method (called Christofides’ method) can ensure w(C) 1.5w(COPT). But such methods need to use more knowledge of combinatorial optimization.

Page 167: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

167

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

• An additional exercise Consider the problem of sequencing n jobs

on a single machine. The jobs can be done in any order and the objective is to complete all of them in the shortest possible time. Assume that the machine must be in certain state Sj in order to do job j (e.g. rotation, temperature, pressure, changing parts, ……) and that the beginning and ending state for the machine is So.

Page 168: 1 Network Optimization Chapter 1 Some Graph Theory Concepts and Trees

168

1.4 The 1.4 The TTraveling raveling SSalesman alesman PProblemroblem

Let the time required to complete job j after job i be

tij=cij+pj

where cij is the time required to transform the machine from state Si to state Sj, and pj is the actual time to perform job j (with po=0).

Formulate this problem as a traveling salesman problem.