Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 TSP in line graphs 2-optimal Euler path problem.

Similar presentations


Presentation on theme: "1 TSP in line graphs 2-optimal Euler path problem."— Presentation transcript:

1 1 TSP in line graphs 2-optimal Euler path problem

2 2 Euler circuit in a directed graph: An Euler circuit in a directed graph is a directed circuit that visits every edge in G exactly once. v1 v2 v3 v6 v5 v4 Figure 1 a b c d e f g

3 3 Theorem 2: If all the vertices of a connected graph have equal in- degrees and out-degrees, then the graph has an Euler circuit.

4 4 2-path: A 2-path is a directed subgraph consisting of two consecutive edges. For example: v is called the midpoint. Every 2-path is given a cost (positive number) A Euler circuit of m edges contains m 2-paths,and the cost of the Euler circuit is the total weight of the m 2-paths. uvw

5 5 2-optimal Euler circuit problem: Instance: A directed graph, each of its vertices has in- degree 2 and out-degree 2 and 2-path has a cost. Question:Find an Euler circuit with the smallest cost among all possible Euler circuits.

6 6 Line graph: If we view each edge in the above graph G(Figure 1) as a vertex,and each 2-path in the above graph as an edge,we get another graph L(G), called line graph. a c b g d f e Figure 2

7 7 Continue: Observation: An Euler circuit in graph G corresponds to a Hamilton circuit in graph L(G). 2-optimal Euler path problem becomes a TSP problem in line graph.

8 8 Theorem 3: TSP in line graph with in-degree 2 and out-degree 2 can be solved in polynomial time. (TSP in general is NP-complete)

9 9 Facts: For each node in G,there are four 2-paths that form 2 pairs of 2-paths. In an Euler circuit,one of the pairs is used. A pair of 2-path for v is good if the total cost of this pair of 2-paths is not less than that of the other pair.

10 10 Algorithm: For each node v in G, fixed the good pair of 2-path for v. (This leads to a set of edge disjoint circles H.) Contract each circle C i in H into a single node n i.There is an edge(undirected) between n i and n j if C i and C j have a common vertex,say,v. The weight on edge (n i,n j ) is w(e1)+w(e2)-w(e3)-w(e4) where e1 and e2 forms a bad pair for v,and e3 and e4 forms a good pair for v.Call H’ be the resulting undirected graph. Construct a minimum spanning tree H’ Construct an Euler circuit for G by merging circles based on the minimum spanning tree obtained in Step3.

11 11 Example: Suppose that the directed Euler graph G is Given in Figure 3(next page).There are 5 cycles.The 2-paths in circles have cost 1 and the costs on other 2-paths are listed below: w(a,e)=2,w(h,b)=2; w(f,i)=3,w(l,g)=3; w(g,t)=2,w(s,h)=11; w(k,m)=1,w(p,l)=2; w(t,o)=2,w(n,q)=3.

12 12 Figure 3 a c d bh g e f l k j i p o m n t q r s

13 13 Step1: we get 5 circles shown below: a c d b h g e f l k j i p o m n t q r s

14 14 Step2: the undirected graph constructed is: 2 4 1 3 11 a,b,c,d e,f,g,h i,j,k,l m,n,o,p q,r,s,t

15 15 Step3: the minimum spanning tree for the above tree is as follows: 2 4 1 3

16 16 Step4: The 2-optimal Euler path is shown below: a c d b h g e f l k j i p o m n t q r s

17 17 Theorem 4: The above algorithm is correct. Proof: The total cost of the 2-paths obtained in Step1 is not greater than that of the optimal solution. To obtain an Euler circuit, we have to merge the k circles obtained in Step1.(needs (k-1) merge operations) These (k-1) merge operations correspond to (k-1) edges in the undirected graph.(In fact, a spanning tree) The final cost is the cost of all the 2-paths obtained in Step1 + the cost of the (minimum) spanning tree. Since we use a minimum spanning tree, the cost of our solution is the smallest.

18 18


Download ppt "1 TSP in line graphs 2-optimal Euler path problem."

Similar presentations


Ads by Google