# The swap edges of a multiple source routing tree * 樹德資工 † 台大資工 Bang Ye Wu* Chih-Yuan Hsiao † Kun-Mao Chao †

## Presentation on theme: "The swap edges of a multiple source routing tree * 樹德資工 † 台大資工 Bang Ye Wu* Chih-Yuan Hsiao † Kun-Mao Chao †"— Presentation transcript:

The swap edges of a multiple source routing tree * 樹德資工 † 台大資工 Bang Ye Wu* Chih-Yuan Hsiao † Kun-Mao Chao †

Swap edge For an edge of a spanning tree T of a undirected graph G –Swap edge: a non-tree minimizing the routing cost of the new tree. –Routing cost: total distance from sources to vertices

Problem Definition Given a undirected graph G=(V, E, w) with a positive edge weight function w and a spanning tree T of G, we want to find the swap edge for every tree edge e ∈ T

Previous result Swap edges for a single-source shortest- paths tree: Time complexity O(n 2 ) Constructing k-sources minimum routing cost spanning tree: –NP hard even for any constant k>1 –PTAS for k=2 and k=n –2-approx. for arbitrary k

Swap edge problem Polynomial time solvable (for any objective function) –Direct method: Compute the costs for all possible edges and choose the best O(kn) for computing the routing cost of a tree O(m) possible edges O(n) tree edges Total: O(kmn 2 )  O(mn 3 ) –How to find the swap edges more efficiently?

Our results The Two-sources case –O(mlogn+n 2 ) The Multiple-sources case –O(mn)

Two-sources case

Two cases 1.The removed edges are not in the path(s 1,s 2 ) ： modify the one-source algorithm slightly! 2.The removed edges are in the path(s 1,s 2 ) ： need some tricks here!

Edges not in the path We create an auxiliary graph with a super node s Then apply the single-source case algorithm!

Our goal is to compute, for each i, min δ(f,i) =D(s 2,Y i )+D(s 1,Y i ) among all f cross the cut r 1 r p r q V 0 V 1 V p V k V q r i r i+1 Y i Y i f x y e i s 1 =r 0 s 2 =r k Edges in Path(s1,s2)

r 1 r p r q V 0 V 1 V p V k V q r i r i+1 Y i Y i f x y e i s 1 =r 0 s 2 =r k E x : 左端點為 x 的 edges For each x, compute F x (i)=min f δ(f,i), (f in E x ) Then, the swap cost of e i is the min of F x (i) among all x.

If y 1 and y 2 are in the same set V q, f ’ 1 and f ’ 2 never intersect in [p,q]. only one edge in a set V q need considered r 1 r p r q V 0 V 1 V p V k V q r i r i+1 Y i Y i f x y e i s 1 =r 0 s 2 =r k

f ’ 1, f ’ 2 and f ’ 3 are in the same set V q

r q V k V q r i+1 Y i f2f2 e i s 2 =r k f1f1 r j j V 若 f1 的右端點 > f2 的右端點 當 i 增加時, 對 f1 必然更有利 我們證明 : f2(i)-f1(i) 是隨著 i 而 monotonically increasing

f ’ 1 and f ’ 2 are from different sets f2 一但在某一點穿越 f1, 就不會在回頭

Merge Process 將 E x 中的 edge 依照右端點 sorting, 由右 向左逐步將 f 合併 ( 取 min) Let F i-1 是前 i-1 個合併之 function, we design an algorithm merging F i-1 and f i F i-1 是由若干個 interval 組成, 每一個 interval 我們知道其最小的 f 為何

Merging process Claim: f i intersects F i-1 at most once, and if so, f i appears at the first interval of F i F i-1 fifi FiFi

Store the intervals of F i-1 in a link list L Scan L from the head to find the intersection interval. Time: O(α i ) Use binary search to find the intersection point in the interval. Time: O(log n) Remove the intervals before the intersection interval, and break the first interval. Time: O(α i ) F i-1 fifi FiFi

The time complexity for scanning and removing the intervals L i : # of intervals of F i α i : # of scanned intervals when merging f i L i = L i-1 - α i +1, L 1 =1 and L h >0. Σα i <=2(h-1)=O(|F x |)

Time complexity Preprocessing: O(n 2 ) For a fixed x eliminating useless edges: O(|E x |) sorting: O(|F x |log|F x |) merge process: O(|F x |logn) Total : O(mlogn+n 2 )

Multiple-sources case

f Routing load l(f) = s1*n2+s2*n1 Routing cost of a tree=Σl(f)*w(f) Can be computed in O(n) time T2T2 T1T1 Routing load

Multiple sources Naive method: n tree edges and m non-tree edges  O(mn 2 ) time Our method: –Find the swap edges individually –For each tree edge e, after a preprocessing stage, the cost of T-e+f can be computed in O(1) time for any non-tree edge f.

Observation There are only two possible values for the routing load of an edge, depending on which side the new edge is connected to.

Compute the two possible routing loads of every edge For each vertex v, compute a value g(v): 如果 new edge 接在 v 點時, 該 subtree 的 routing cost Can be done by traversing the tree twice  O(n)

Future work More efficient algorithms, especially for k>2 Swap edges for different objective

Download ppt "The swap edges of a multiple source routing tree * 樹德資工 † 台大資工 Bang Ye Wu* Chih-Yuan Hsiao † Kun-Mao Chao †"

Similar presentations