260 likes | 397 Views
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 .
E N D
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(n2) • 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(kmn2) O(mn3) • How to find the swap edges more efficiently?
Our results • The Two-sources case • O(mlogn+n2) • The Multiple-sources case • O(mn)
Two cases 1.The removed edges are not in the path(s1,s2): modify the one-source algorithm slightly! 2.The removed edges are in the path(s1,s2): 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!
Y Y i i r r r s = r r s = r r i 1 0 1 2 k p i + 1 q e i y x f V V V V V k 0 1 p q Edges in Path(s1,s2) Our goal is to compute, for each i, min δ(f,i) =D(s2,Yi)+D(s1,Yi) among all f cross the cut
Y Y i i r r r s = r r s = r r i 1 0 1 2 k p i + 1 q e i • Ex: 左端點為x的edges • For each x, compute Fx(i)=minfδ(f,i), (f in Ex) • Then, the swap cost of ei is the min of Fx(i) among all x. y x f V V V V V k 0 1 p q
Y Y i i r r r s = r r s = r r i 1 0 1 2 k p i + 1 q e i y x f V V V V V k 0 1 p q • If y1 and y2 are in the same set Vq, f’1and f’2never intersect in [p,q]. • only one edge in a set Vq need considered
Y i r j r s = r 2 k r i + 1 q e i f1 f2 V V q j V k 若f1的右端點 > f2的右端點 當i增加時, 對f1必然更有利 我們證明: f2(i)-f1(i)是隨著i而monotonically increasing
f’1 and f’2 are from different sets f2一但在某一點穿越f1, 就不會在回頭
Merge Process • 將Ex中的edge依照右端點sorting, 由右向左逐步將f合併(取min) • Let Fi-1是前i-1個合併之function, we design an algorithm merging Fi-1 and fi • Fi-1 是由若干個interval組成, 每一個interval我們知道其最小的f為何
Merging process • Claim: fiintersects Fi-1at most once, and if so, fi appears at the first interval of Fi fi Fi-1 Fi
fi Fi-1 Fi • Store the intervals of Fi-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 )
The time complexity for scanning and removing the intervals • Li : # of intervals of Fi • αi: # of scanned intervals when merging fi • Li= Li-1-αi+1, L1=1 and Lh>0. • Σαi<=2(h-1)=O(|Fx|)
Time complexity • Preprocessing: O(n2) • For a fixed x eliminating useless edges: O(|Ex|) sorting: O(|Fx|log|Fx|) merge process: O(|Fx|logn) • Total : O(mlogn+n2)
Routing load T1 T2 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
Multiple sources • Naive method: n tree edges and m non-tree edges O(mn2) 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