1: \documentclass{article}
2: \usepackage{graphicx}
3: \usepackage{amssym}
4:
5: \newcommand{\rbox}{\begin{flushright}
6: \vspace{-8mm}
7: \qed
8: \vspace{-1mm}
9: \end{flushright}
10: }
11:
12:
13:
14: \oddsidemargin .25in
15: \setlength\topmargin{-.4in}
16: \setlength\textheight{8.7in}
17: \setlength\textwidth{6in}
18:
19:
20:
21:
22: \def\trp{{trapezoid}}
23: \def\Then{ ~\underline{Then}~}
24: \def\If{\underline{If}~}
25: \def\Begin{\underline{Begin}~}
26: \def\For{\underline{For}~}
27: \def\Repeat{\underline{Repeat}~}
28: \def\Do{\underline{Do}~}
29: \def\Return{\underline{Return}~}
30: \def\Else{\underline{Else}~}
31: \def\End{\underline{End}~}
32: \def\While{\underline{While}~}
33: \def\Loop{\underline{Loop}~}
34: \def\Until{\underline{Until}~}
35:
36:
37:
38: \newcommand{\figlab}[1]{\label{fig:#1}}
39: \newcommand{\figref}[1]{Figure \ref{fig:#1}}
40: \def\marrow{{\marginpar[\hfill$\longrightarrow$]{$\longleftarrow$}}}
41: \def\alon#1{{\sc Alon says: }{\marrow\sf #1}}
42: \def\eps{\varepsilon}
43: \def\B{{\cal B}}
44: \def\T{{\cal T}}
45: \def\D{{\cal D}}
46: \def\E{{\cal E}}
47: \def\Cov{\mbox{\sl Cov}}
48: \def\bt{\beta}
49: \def\al{\alpha}
50: \def\bd{{\partial}}
51: \def\R{{\cal R}}
52: \newcommand{\comm}[1]
53: {\marginpar{$\longleftarrow$}$\,\mbox{}^{\rm com}${\sf #1}$\mbox{}_{\rm ment}\,$}
54: \newcommand{\Fr}{Fr\'{e}chet\ }
55: \newcommand{\Frd}{Fr\'{e}chet distance\ }
56: \newcommand{\f}{\ensuremath{d_F}}
57: \newcommand{\wf}{\ensuremath{d_{\tilde{F}}}}
58: \newenvironment{proof}{\noindent{\bf Proof:}}{{\rbox}}
59: \newenvironment{sketch}{\noindent{\bf Proof Sketch:}}{{\rbox}}
60: \def\reals{{I\!\!R}}
61: \def\Reals{{\reals}}
62:
63: \newtheorem{Def}[section]{Definition}
64: \newtheorem{Claim}{Claim}[section]
65: \newtheorem{Lemma}[Claim]{Lemma}
66: \newtheorem{theorem}{Theorem}\newtheorem{corollary}[Claim]{Corollary}
67:
68:
69: \newcommand{\euclidean}{{\Bbb E}}
70: \renewcommand{\reals}{{\Bbb R}}
71: \newcommand{\sphere}{{\Bbb S}}
72: \newcommand{\integers}{{\Bbb Z}}
73: \newcommand{\naturals}{{\Bbb N}}
74: \newcommand{\complex}{{\Bbb C}}
75: \newcommand{\rationals}{{\Bbb Q}}
76: \newcommand{\seg}[1]{\overline{#1}}
77: \def\TP{{\sl TP}\ }
78: \def\S{{\cal S}}
79: \def\maxs{{\sl max}(\sum}
80: \def\maxs{{\sl max\_}\sum}
81: \def\F{{\cal F}}
82: \def\epsilon{\varepsilon}
83: \def\Pos{{\sl Pos}}
84: \def\Neg{{\sl Neg}}
85: \long\gdef\boxit#1{\vspace{5mm}\begingroup\vbox{\hrule\hbox{\vrule\kern3pt
86: \vbox{\kern4pt#1\kern3pt}\kern3pt\vrule}\hrule}\endgroup}
87: \newcommand{\qed}{\vspace{.15cm}\rule{6pt}{6pt}}
88:
89:
90: \newcommand{\comment}[1]{}
91:
92: \setcounter{section}{-1}
93:
94: \title{Computing Homotopic Shortest Paths Efficiently
95: }
96:
97: \author{
98: Alon Efrat\\
99: Department of Computer Science\\
100: University of Arizona\\
101: {\tt alon@cs.arizona.edu}
102: \and
103: Stephen G.~Kobourov\\
104: Department of Computer Science\\
105: University of Arizona\\
106: {\tt kobourov@cs.arizona.edu}
107: \and
108: Anna Lubiw\\
109: Department of Computer Science\\
110: University of Waterloo\\
111: {\tt alubiw@uwaterloo.ca}
112: \and
113: }
114:
115:
116: \begin{document}
117: \def\polylog{{{\sl polylog }}}
118:
119: \maketitle
120: \begin{abstract} \small\baselineskip=9pt
121:
122: This paper addresses the problem of finding shortest paths homotopic
123: to a given disjoint set of paths that wind amongst point obstacles in
124: the plane. We present a faster algorithm than previously known.
125:
126: \end{abstract}
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145: \section{Introduction} \label{section:introduction}
146:
147:
148: Finding Euclidean shortest paths in simple polygons is a well-studied
149: problem. The funnel algorithm of Chazelle~\cite{FOCS82*339} and Lee
150: and Preparata~\cite{LP84} finds the shortest path between two points
151: in a simple polygon. Hershberger and Snoeyink~\cite{HerSno94} unify
152: earlier results for computing shortest paths in polygons. They
153: optimize a given path among obstacles in the plane under the Euclidean
154: and link metrics and under polygonal convex distance functions.
155: Related work has been done in addressing a classic VLSI problem, the
156: continuous homotopic routing problem~\cite{cs-rrew-84,lm-artr-85}. For
157: this problem it is required to route wires with fixed terminals among
158: fixed obstacles when a sketch of the wires is given, i.e., each wire
159: is given a specified homotopy class. If the wiring sketch is not given
160: or the terminals are not fixed, the problem is
161: NP-hard~\cite{Leiserson:1983:OPR,pinter83river-routing,Richards84b}.
162:
163: Some of the early work on continuous homotopic routing was done by
164: Cole and Siegel~\cite{cs-rrew-84} and Leiserson and
165: Maley~\cite{lm-artr-85}. They show that in the $L_\infty$ norm a solution
166: can be found in $O(k^3 \log n)$ time and $O(k^3)$ space, where $n$ is
167: the number of wires and $k$ is the maximum of the input and output
168: complexities of the wiring. Maley~\cite{maley-thesis} shows how to
169: extend the distance metric to arbitrary polygonal distance functions
170: (including Euclidean distance) and presents a $O(k^4 \log n)$ time and
171: $O(k^4)$ space algorithm. The best result so far is due to Gao {\em
172: et al.}~\cite{Storb88} who present a $O(kn^2 \log(kn))$ time and
173: $O(kn^2)$ space algorithm. Duncan {\em et al.}~\cite{dekw-dwfe01} and Efrat {\rm et al.}~\cite{eksw-gfg-02}
174: present an $O(kn+n^3)$ algorithm for the related fat edge drawing
175: problem: given a planar weighted graph $G$ with maximum degree 1 and
176: an embedding for $G$, find a planar drawing such that all the edges
177: are drawn as thick as possible and proportional to the corresponding
178: edge weights.
179:
180:
181: The topological notion of homotopy formally captures the notion of
182: deforming paths. Let $\alpha,\beta:[0,1]\longrightarrow\Reals^2$ be two continuous
183: curves parameterized by arc-length. Then $\alpha$ and $\beta$ are
184: {\it homotopic\/}
185: with respect to a set of obstacles $V\subseteq \reals^2$
186: if $\alpha$ can be continuously deformed into $\beta$ while avoiding the obstacles;
187: more formally,
188: if there exists a continuous
189: function $h:[0,1]\times [0,1]
190: \rightarrow \Reals^2$ with the following three properties:
191: \newpage
192: \begin{enumerate}
193: \item $h(0,t)=\alpha(t)$ and $h(1,t)=\beta(t)$, for $0\leq t \leq 1$
194: \item $h(\lambda,0)=\alpha(0)=\beta(0)$ and $h(\lambda,1)=\alpha(1)=\beta(1)$ for $0\leq
195: \lambda \leq 1$
196: \item $h(\lambda,t) \notin V$ for $0 \leq \lambda \leq 1, 0 < t<1$
197: \end{enumerate}
198:
199: Let $\Pi=\{\pi_1, \pi_2, \dots, \pi_n\}$ be a set of disjoint, simple
200: polygonal paths and let the endpoints of the paths in $\Pi$ define the
201: set $T$ of at most $2n$ fixed points in the plane.
202: Note that we allow a path to degenerate to a single point.
203: We call the fixed points of
204: $T$ ``terminals,'' and call the interior vertices of the paths ``bends,''
205: and use ``points'' in a more generic sense, e.g. ``a point in the
206: plane,'' or ``a point on a path.''
207: We assume that no two terminals/bends lie on the same vertical line.
208:
209: Our goal is to replace each path $\pi_i\in \Pi$ by a shortest path $\sigma_i$
210: that
211: is homotopic to $\pi_i$ with respect to the set of obstacles $T$, see Fig.~\ref{fig-complexity} and Fig.~\ref{fig-monotone}.
212: Note that $\sigma_i$ is unique. Let $\Sigma = \{\sigma_1, \ldots
213: \sigma_n\}$ be the set of resulting paths.
214: Observe
215: that these output paths may [self] intersect by way of segments
216: lying on top of each other, but will be
217: {\it non-crossing\/} in the sense that a slight perturbation of the bends
218: makes the paths simple and disjoint.
219:
220: Let $k_{\it in}$ be the number of edges in all the paths of $\Pi$.
221: Let $k_{\it out}$ be the number of edges in all the paths of $\Sigma$. We
222: will measure the complexity of our algorithms in terms of $n$ and $k =
223: \max\{k_{\it in}, k_{\it out}\}$. In fact, the only relationship guaranteed
224: among the parameters $n, k_{\it in}, k_{\it out}$ is $k_{\it out} \le
225: nk_{\it in}$. Note that $k$ may be arbitrarily large compared to $n$.
226: Clearly this is the case since, for example, a path can wind around a
227: set of terminals arbitrarily many times. However, there exist
228: non-trivial cases in which $k$ can be much larger than $n$. Even after
229: shortest paths have been computed for each wire, $k$ can be as large
230: as $k=\Omega(2^n)$, see Fig.~\ref{fig-complexity}.
231: The algorithm of Hershberger and
232: Snoeyink~\cite{HerSno94} runs in time $O(nk)$. The algorithm presented in
233: this paper runs in time $O(n^{2+\eps} + k \log^2 n)$, which is an
234: improvement for $n<k$.
235:
236: \begin{figure}[t]
237: \begin{center}
238: {\includegraphics[width=12cm]{complexity6.eps}}
239: \caption{\small\sf
240: An example with exponential complexity: $k=\Omega(2^n)$: On the left
241: is the initial wiring sketch, and on the right is the wiring after the shortest paths have been computed. The number of edge segments in the shortest paths $\sigma_1, \sigma_2, \sigma_3, \sigma_4$ is $1,2,4,8$, respectively. In general, wire $\sigma_i$ has $2^{i-1}$ edge segments. Note that on the right many edge segments are parallel. }
242: \label{fig-complexity}
243: \end{center}
244: \end{figure}
245:
246:
247:
248:
249:
250:
251: Although $k$ can be arbitrarily large compared to $n$, one easily
252: forms the intuition that, because the paths are simple and disjoint,
253: $k$ can be large in a non-trivial way only because path sections are
254: repeated over and over. For example, a path may spiral arbitrarily
255: many times around a set of points, but each wrap around the set is the
256: same.
257:
258: Our method makes essential use of this observation. We do not begin
259: by explicitly searching for repeated path sections---this seems
260: difficult modulo homotopic equivalence. Instead we begin in section 2
261: by applying vertical shortcuts to the paths (homotopically) so
262: that each left and each right local
263: extreme point occurs at a terminal. These terminals must then be part of the
264: final shortest paths, and we have decomposed the paths into $x$-monotone
265: pieces with endpoints at terminals.
266: In section 3 we argue that the number of homotopically
267: distinct $x$-monotone
268: pieces is at most $O(n)$.
269: We will bundle together all the homotopically equivalent pieces.
270: Routing one representative from each such bundle using the
271: straightforward ``funnel'' technique takes $O(k + n^2)$ time total. In
272: section 3 we reduce this using a ``shielding technique'' where we
273: again exploit the fact that the paths are disjoint and use the
274: knowledge gained in routing one shortest path to avoid repeating work
275: when we route subsequent paths.
276: The final step of the algorithm is to unbundle, and recover the final
277: paths by putting together the appropriate pieces.
278: We summarize the main steps of the algorithm in Fig.~\ref{fig-summary}.
279:
280: \begin{figure}[t]
281: \medskip
282: \noindent
283: \begin{center}
284: \fbox{
285: \begin{minipage}{9.5in}
286: \baselineskip 1mm
287: \begin{tabbing}
288: \hspace{6mm}\=\hspace{6mm}\=\hspace{6mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\= \kill
289: {\bf Main Algorithm}\\
290: \> 1. shortcut paths to divide into monotone pieces\\
291: \> 2. bundle homotopically equivalent pieces\\
292: \> 3. find the shortest path for each bundle\\
293: \> 4. unbundle to recover final paths
294: \end{tabbing}
295: \end{minipage}
296: }
297: \end{center}
298: \smallskip
299: \caption{\small\sf Summary of the algorithm.}
300: \label{fig-summary}
301: \end{figure}
302:
303: Before we turn to the remainder of the paper, which consists of one
304: section for each of steps 1, 2, and 3, it is worth noting that we rely on
305: some powerful techniques. In step 1, we use simplex range search
306: queries to perform homotopic simplifications on the paths. To do
307: this, we use Chazelle's cutting trees data
308: structure~\cite{Chazelle93b}. In step 2 we need to identify
309: homotopically equivalent monotone path pieces. We use the efficient
310: trapezoidization algorithm of Bar-Yehuda and
311: Chazelle~\cite{BC-tdjc-94} to perform this step. Step 3 uses ideas
312: from ``funnel'' algorithms for shortest paths~\cite{LP84}.
313: Step 4 is straight-forward.
314:
315: We will find it convenient to regard each terminal as a small diamond.
316: Otherwise when a vertical shortcut goes through a terminal we will
317: need to specify whether the path actually goes to the left or the right of
318: the terminal, which is awkward to say and to draw.
319:
320:
321:
322:
323:
324:
325:
326:
327: \section{Shortcutting to Divide Paths into Monotone Pieces}
328:
329:
330: We begin by applying vertical shortcuts to reduce each path to a
331: sequence of $x$-monotone path sections, see Fig.~\ref{fig-monotone}.
332: A {\it vertical
333: shortcut\/} is a vertical line segment $ab$ joining a point $a$ on
334: some path $\pi$ with a point $b$ also on $\pi$, and with the property that
335: the subpath of $\pi$ joining $a$ and $b$, $\pi_{ab}$, is homotopic to the
336: line segment $ab$.
337:
338: \begin{figure}[h]
339: \begin{center}
340: {\includegraphics[width=12cm]{monotone3.eps}}
341: \caption{\small\sf
342: (a)
343: Two paths $\pi_1$ and $pi_2$ joining terminals $t_1$ to $t_2$ and $t_3$
344: to $t_4$, respectively. (b) The two paths after performing vertical
345: shortcuts. Note that path $\pi_1$ now consists of 3 monotone pieces: $\mu_1$ from $t_1$ to $t_3$, $\mu_2$ from $t_3$ to $t_4$, and $\mu_3$ from $t_4$ to $t_2$; path $\pi_2$ now
346: consists of one $x$-monotone piece, $\mu_4$, homotopically equivalent to $\mu_2$; (c) The final homotopically equivalent
347: shortest paths, $\sigma_1$ and $\sigma_2$. }
348: \label{fig-monotone}
349: \end{center}
350: \end{figure}
351:
352:
353:
354: We will only do {\it elementary vertical shortcuts\/} where the subpath
355: $\pi_{ab}$ consists of [portions of] 2 line segments or
356: 3 line segments with the middle one
357: vertical, and the other two non-vertical.
358: We distinguish {\it left shortcuts\/} which are elementary vertical
359: shortcuts where $\pi_{ab}$ contains a point to the left of the line through $ab$;
360: {\it right shortcuts\/} where $\pi_{ab}$ contains a point to the right of
361: the line through $ab$; and {\it collinear shortcuts\/} where $\pi_{ab}$
362: lies in the line through $ab$, see Fig.~\ref{fig-left} and
363: Fig.~\ref{fig-shortcuts}.
364: Collinear shortcuts are always applied after left/right shortcuts
365: (and only then), and prevent consecutive vertical segments.
366:
367: \begin{figure}[t]
368: \begin{center}
369: {\includegraphics[width=14cm]{left2.eps}}
370: \caption{\small\sf
371: Maximal left shortcuts (bends are represented by circles and
372: terminals by diamonds):
373: (a) a 2 segment shortcut, maximal because $a$ is a bend; (b) a 3 segment
374: shortcut, maximal for the same reason; (c) a 3 segment shortcut,
375: maximal because $ab$ hits a terminal; (d) the result of the shortcut in (c).
376: }
377: \label{fig-left}
378: \end{center}
379: \end{figure}
380:
381:
382: \begin{figure}[t]
383: \begin{center}
384: {\includegraphics[width=14cm]{collinear2.eps}}
385: \caption{\small\sf
386: A sequence of maximal elementary vertical shortcuts
387: (bends are represented by circles and terminals by diamonds).
388: Shortcuts $a_1b_1$ and $a_2b_2$ are left shortcuts; $a_3b_3$ is a right
389: shortcut; and $a_4b_4$ and $a_5b_5$ are collinear shortcuts.
390: }
391: \label{fig-shortcuts}
392: \end{center}
393: \end{figure}
394:
395:
396:
397: We will in fact only apply {\it maximal\/} elementary vertical shortcuts,
398: where the
399: subpath $\pi_{ab}$ cannot be increased. In particular, this means
400: that for left and right shortcuts, either $a$ or $b$ is a bend,
401: or the line segment $ab$ hits a terminal.
402:
403: A {\it local left [right] extreme\/} of a path is
404: a point or, more generally, a vertical segment,
405: where the $x$-coordinate of the path reaches a local min [max].
406: Observe that every left [right] shortcut ``cuts off'' a local left [right]
407: extreme. Conversely, every left [right] local extreme provides a left
408: [right] shortcut {\it unless\/} the local extreme
409: {\it is locked at\/} a terminal,
410: meaning that the left [right] extreme contains the left [right] point of the
411: terminal's diamond.
412: Figure~\ref{fig-left} shows 4 cases of left extremes; in (a--c) they provide
413: left shortcuts, but in case (d) the left extreme is locked at a terminal.
414:
415: We will use range searching to detect, for a local left extreme, $l$,
416: the maximal left shortcut that can be performed there.
417: In particular, given $l$, we first identify the maximal potential shortcut
418: in the absence of terminals.
419: To do this, take the segment preceding $l$ and the segment following $l$
420: along the path. Take their right endpoints, and let $t$ be the leftmost
421: of these two points. Then $t$ determines the maximal potential shortcut
422: that can be performed at $l$.
423: This potential shortcut forms either
424: a triangle (for example, triangle $abl$ in Figure~\ref{fig-left}(a))
425: or a trapezoid (for example, the trapezoid determined by $a$, $b$, and $l$,
426: in Figure~\ref{fig-left}(b)).
427: If a range query tells us that the triangle/trapezoid is free of terminals,
428: then it forms the true maximal shortcut from $l$.
429: Otherwise, the range query should tell us the leftmost terminal inside
430: the triangle/trapezoid, and that determines the maximal left shortcut from $l$.
431: Note that the ranges we need to
432: query are triangles with one vertical side, and trapezoids with two
433: vertical sides.
434:
435: Our algorithm is to perform elementary vertical shortcuts until none
436: remain, at which time all local left and right extremes are locked at
437: terminals, so the path divides into monotone pieces.
438: See Section \ref{section:monotone-correctness} for justification.
439: Doing elementary vertical shortcuts in an arbitrary order may result in crossing
440: paths as shown in Fig.~\ref{fig-crossing}; to guarantee
441: non-crossing paths we will do the elementary vertical shortcuts
442: in alternating {\it left\/} and {\it right phases\/},
443: where a {\it left [right] phase\/} means we do
444: left [right] shortcuts (and the consequent collinear shortcuts)
445: until no more are possible.
446: See Section \ref{section:non-crossing} for justification.
447: We summarize these steps in Fig.~\ref{fig-pseudocode}.
448:
449:
450:
451:
452: \begin{figure}[thb]
453: \noindent
454: \fbox{
455: \begin{minipage}{9.5in}
456: \baselineskip 1mm
457: \begin{tabbing}
458: \hspace{6mm}\=\hspace{6mm}\=\hspace{6mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\=\hspace{5mm}\= \kill
459:
460: {\tt ShortCut}\\
461: \vspace{1cm}
462:
463: traverse paths initializing\\
464: \> $L$ $\leftarrow$ $\{$local left extremes not locked at terminals$\}$\\
465: \> $R$ $\leftarrow$ $\{$local right extremes not locked at terminals$\}$\\
466: \Loop\\
467: \> {\tt LeftPhase}\\
468: \> {\tt RightPhase}\\
469: \Until $L$ and $R$ are empty\\ \\
470: \vspace{1cm}
471:
472: {\tt LeftPhase}\\
473: \While $L$ is non-empty\\
474: \> \> $l \leftarrow$ remove an element of $L$\\
475: \> \> $\tau \leftarrow$ the triangle/trapezoid forming the maximal potential shortcut at $l$\\
476: \> \> RangeQuery($\tau$) \\
477: \> \>\If $\tau$ is empty of terminals\\
478: \> \>\>$s \leftarrow$ right side of $\tau$\\
479: \> \>\Else\\
480: \> \>\> $s \leftarrow$ leftmost terminal inside $\tau$\\
481: \> \>do a left shortcut of $\tau$ to $s$\\
482: \> \>perform consequent collinear shortcuts\\
483: \> \>\If any right local extremes disappear, remove them from $R$\\
484: \> \>\If the final vertical segment is a local left [right] extreme and not
485: locked at a terminal\\
486: \> \>\>add it to $L$ [$R$, resp.]\\ \\
487: \vspace{1cm}
488:
489: {\tt RightPhase}\\
490: (defined analogous to {\tt LeftShortcut} but with ``left'' and ``right'' exchanged)
491:
492:
493: \end{tabbing}
494: \end{minipage}
495: }
496: \medskip
497: \caption{\small\sf Pseudo-code for the shortcutting phase of the algorithm.}
498: \label{fig-pseudocode}
499: \end{figure}
500:
501: \begin{figure}[t]
502: \begin{center}
503: {\includegraphics[width=10cm]{crossing.eps}}
504: \caption{\small\sf
505: Performing shortcuts in arbitrary order may result in crossings. (a) Two disjoint paths $w_1$ and $w_2$; (b) After a left shortcut in $w_1$ and a right shortcut in $w_2$ there is a crossing. Note that no further shortcuts are possible for either path, and hence the crossing cannot be removed; (c) If both shortcuts are right [left] there are no crossings.
506: }
507: \label{fig-crossing}
508: \end{center}
509: \end{figure}
510:
511: The remainder of this section consists of four subsections:
512: Subsection \ref{section:correctness} justifies organizing the above algorithm
513: around the sets of left and right extremes, rather than explicitly searching
514: each time for a shortcut to perform.
515: Subsection \ref{section:monotone-correctness} establishes the fact that
516: performing elementary vertical shortcuts enables us to divide the
517: paths into $x$-monotone pieces with endpoints at terminals.
518: Subsection \ref{section:non-crossing}
519: argues that doing elementary vertical shortcuts in left/right phases prevents
520: crossings.
521: Finally, Subsection \ref{section:implementation} deals with
522: implementation and run-time analysis.
523:
524:
525:
526: \subsection{Correctness} \label{section:correctness}
527:
528: The point of this section is to show that the above algorithm
529: correctly maintains the sets $L$ and $R$
530: of local left and right extremes not locked at terminals.
531: Consider a left phase. The set $R$ is explicitly updated whenever it changes.
532: For the correctness of $L$ we use:
533:
534: \begin{Claim} \label{claim:left-preservation}
535: Doing one left shortcut does not alter other local left extremes,
536: nor the shortcuts that will be performed there.
537: \end{Claim}
538:
539: \begin{proof}
540: A left shortcut only removes left portions of non-vertical segments.
541: \end{proof}
542:
543: We note that a similar claim fails for collinear shortcuts: doing one
544: may prevent others.
545:
546: \subsection{Correctness of division into monotone pieces} \label{section:monotone-correctness}
547:
548: \begin{Claim} \label{claim:shortcut-structure}
549: At the end of a left [right] phase of shortcuts, each local left
550: [right] extreme is locked at a terminal.
551: \end{Claim}
552:
553: We note that more than one left and one right phase may be required, since
554: the right phase may add new members to $L$, see Fig.~\ref{fig-many-phases}.
555:
556:
557: \begin{figure}[t]
558: \begin{center}
559: {\includegraphics[width=12cm]{phases.eps}}
560: \caption{\small\sf
561: A path going through alternating left and right shortcutting phases: (a) the original path; (b) after a left phase; (c) after a right phase; (d) after a left phase; (e) after a right phase.
562: }
563: \label{fig-many-phases}
564: \end{center}
565: \end{figure}
566:
567:
568:
569: \begin{Claim} \label{claim:shortcut-correctness}
570: Let $\pi$ be a path, and let
571: $\mu$ be a result of performing left and right phases
572: of elementary vertical shortcuts on $\pi$ until no more are possible.
573: Suppose that the local left and right
574: extremes of $\mu$ are locked at the terminals $t_{i_1}, \ldots, t_{i_l}$
575: in that order.
576: Let $\sigma$ be a shortest path homotopic to $\pi$.
577: Then the local left [right] extremes of $\sigma$ are locked at exactly the same
578: ordered list of terminals, and furthermore, the portion of $\sigma$
579: between $t_{i_j}$ and $t_{i_{j+1}}$ is a shortest path homotopic to the portion
580: of $\mu$ between those same terminals.
581:
582: \end{Claim}
583:
584: \begin{sketch} Because $\pi$ and $\mu$ are homotopic, $\sigma$ is the
585: shortest path homotopic to $\mu$. We can thus go from $\mu$ to $\sigma$
586: using ``rubber band'' deformations that only shorten the path, and such
587: deformations cannot loosen a left [right] extreme from the terminal
588: it is locked at.
589: \end{sketch}
590:
591: \def\T{{\cal T}}
592:
593: \subsection{Non-crossing paths}\ \label{section:non-crossing}
594: The purpose of this section is to prove the following:
595:
596: \begin{Lemma} Each left [right] phase of shortcuts preserves the
597: property that paths are non-crossing.
598: \end{Lemma}
599:
600: By symmetry, we can concentrate on a left phase.
601: Note that a left phase, as we have described it, is non-deterministic.
602: At each stage we choose one member $l$ from
603: the set $L$ of current local left extremes,
604: and use it to perform a left shortcut.
605: To prove the Lemma we will first show that for each left phase there is
606: {\it some\/} sequence of choices that preserves the property that
607: the paths are non-crossing.
608: We will then argue that the end result of a phase does not depend on
609: the choices made.
610:
611: \begin{Claim} Suppose we have a set of non-crossing paths.
612: Let $L$ be the current set of local left extremes not locked at
613: terminals, and let $l \in L$ be a rightmost element of $L$.
614: Performing the shortcut for $l$ (together with any consequent collinear
615: shortcuts) leaves the paths non-crossing.
616: \end{Claim}
617:
618:
619: Observe that we can---at least in theory---complete a left phase of shortcuts
620: using this ``rightmost'' order.
621: In practice we choose not to
622: do this simply because of the extra time required to maintain a heap.
623:
624: \begin{Lemma}
625: The end result of a left phase does not depend on the sequence of choices
626: made during the phase.
627: \end{Lemma}
628:
629: \begin{proof}
630: We begin with the claim that the set $\cal L$ of all local left extremes
631: that appear in $L$ over the course of the phase is independent of the choices
632: made during the phase.
633:
634: This implies that the set of left shortcuts performed during the
635: course of the phase is also independent of the choices made during the phase.
636: However, the set of collinear shortcuts is {\it not\/} independent.
637: In particular, the order in which we perform left shortcuts affects
638: the set of collinear shortcuts, see Fig.~\ref{fig-bigmess}.
639:
640: \begin{figure}[t]
641: \begin{center}
642: {\includegraphics[width=9cm]{bigmess.eps}}
643: \caption{\small\sf
644: (a) A given path undergoes a right phase; (b)
645: Handling local left extreme $l_1$ first yields the shortcut $ab$. Handling the local left extreme $l_2$ first yields shortcut $cd$. The final result of handling $l_1$, $l_2$ and $l_3$ in any order is shortcut $ce$; (c) An ``unfolded'' version of part (b).
646: }
647: \label{fig-bigmess}
648: \end{center}
649: \end{figure}
650:
651:
652: Consider one left phase. Let $L_0$ be the initial set of local left
653: extremes not locked at terminals. Let $\cal L$ be the union of $L$
654: over the course of the phase. Suppose two sequences of choices $C_1$
655: and $C_2$ during a left phase yield sets ${\cal L}_1$ and ${\cal
656: L}_2$. We would like to show that ${\cal L}_1 = {\cal L}_2$.
657: Consider $l \in {\cal L}_1$. We will prove $l \in {\cal L}_2$ by
658: induction on the number of left shortcuts performed in the phase
659: before $l$ enters ${\cal L}_1$. If this number is 0 then $l \in L_0$
660: and we are done. Otherwise, $l$ is added to $L$ as a result of some
661: left shortcut and consequent collinear shortcuts. Any vertical
662: segment used in the collinear shortcuts may, in its turn, have arisen
663: as a result of some left shortcut and consequent collinear shortcuts.
664: Tracing this process, we find that $l$ is formed from a set of left
665: shortcuts linked by vertical segments, all in the same vertical line
666: as $l$, see Fig.~\ref{fig-bigmess}.
667: All these left shortcuts arose from
668: local left extremes that entered ${\cal L}_1$ before $l$ did, and
669: thus, by induction, are in ${\cal L}_2$. By
670: Claim~\ref{claim:left-preservation} left shortcuts are performed at
671: each of these during the choice sequence $C_2$---though possibly in a
672: different order than in $C_1$. The consequent collinear shortcuts
673: will merge all the verticals forming $l$, and cannot merge more than
674: that because the segments attached before and after $l$ are not
675: vertical ($l$ is a local left extreme). Thus $l$ is in ${\cal L}_2$.
676:
677:
678:
679:
680:
681:
682: This proves that the set of local left extremes, and thus the set
683: of left shortcuts is independent of choices made during the phase.
684: Any vertical segment that is in the final set of paths output
685: by the phase arises through left shortcuts plus consequent collinear
686: shortcuts. Since any set of choices leads to the same set of left shortcuts,
687: though possibly in different order, the consequent collinear shortcuts
688: will arrive at the same final vertical shortcuts---i.e. the same
689: final paths.
690:
691: \end{proof}
692:
693: \subsection{Implementation and run-time analysis} \label{section:implementation}
694:
695: \def\eps{\varepsilon}
696:
697: In order to perform range queries we need the cutting trees
698: data structure of Chazelle~\cite{Chazelle93b}. The cutting
699: trees can be constructed in $O(n^{2+\eps})$ time and space, where $\eps$ is an
700: arbitrarily small constant,
701: and they support simplex range queries in time
702: $O(\log n)$ ~\cite{Chazelle93b}.
703: (Note that a trapezoid is a union of two triangles.)
704: In case a triangle that we query is not empty,
705: we need to find the rightmost/leftmost terminal inside it.
706: To do this, create a segment tree $\T$ on the $x$-projections of the terminals,
707: and maintain a cutting tree on each node of $\T$.
708: This enables us to find the rightmost/leftmost
709: terminal inside a query triangle in time $O(\log^2n)$, without
710: increasing the asymptotic space and preprocessing time.
711: Details are standard and omitted from this abstract.
712:
713:
714: \begin{Claim} \label{claim:shortcut-bounds}
715: The number of elementary vertical shortcuts that
716: can be applied
717: to a set of paths with a total of $k$ segments is at most $2k$.
718: \end{Claim}
719:
720: \begin{proof}
721: Assume that no two terminals and/or bends line up vertically.
722: Consider the set of vertical lines through bends and
723: through the left and right sides of each terminal's diamond.
724: An elementary shortcut operates between two of these vertical lines. If
725: a left [right] shortcut has its leftmost [rightmost] vertical at a
726: bend, then after the shortcut, this vertical disappears forever, see Fig.~\ref{fig-shortcuts}. There are thus at most $k$ such elementary
727: shortcuts. Consider, on the other hand, a left shortcut that has its
728: leftmost vertical at a terminal. This only occurs when two previous
729: left shortcuts are stopped at the terminal, and then combined in a collinear
730: shortcut. See the right hand pictures of
731: Fig.~\ref{fig-shortcuts}. Thus an original edge of the path has disappeared.
732: Note that elementary shortcuts never fragment an edge of the path into two
733: edges, but only shorten it from one end or the other. Thus there are at most
734: $k$ elementary shortcuts of this type. Altogether, we obtain a bound
735: of $2k$ elementary shortcuts.
736: \end{proof}
737:
738: This implies the following simple corollary:
739:
740: \begin{corollary}
741: The running time of the shortcutting phase, not counting the
742: preprocessing to construct cutting trees, is $O(k \log^2n )$.
743: \end{corollary}
744:
745: Including preprocessing, step 1 takes time
746: $O(n^{2+\eps} + k \log^2 n)$.
747:
748: \section{Bundling Homotopically Identical Paths}
749:
750:
751: Let $M=\{\mu_1\dots \mu_m \}$ be the set of $x$-monotone paths
752: obtained from step 1 of our algorithm. In the second step of
753: the algorithm we bundle homotopically equivalent paths in $M$.
754: More precisely, we take
755: one representative path for each equivalence class of homotopically
756: equivalent paths in $M$.
757: This is justified because the paths in each equivalence class have the
758: same homotopic shortest path.
759: Because the paths in $M$ are non-crossing and $x$-monotone, it is
760: easier to detect
761: homotopic equivalence: two paths are homotopically equivalent if they
762: have the same endpoints, and, between these endpoints
763: no terminal lies vertically above one path and vertically below the other.
764:
765: In order to perform the bundling we use a
766: trapezoidization of $M$, see Fig.~\ref{fig-trapez}. We apply the trapezoidization algorithm of
767: Bar-Yehuda and Chazelle~\cite{BC-tdjc-94} to the paths obtained after
768: the shortcuts of step 1, but before these paths are chopped
769: into monotone pieces.
770:
771: \begin{figure}[t]
772: \begin{center}
773: {\includegraphics[width=4cm]{trapez.eps}}
774: \caption{\small\sf
775: A trapezoidization enables us to identify that $\mu_2$ and $\mu_4$ are homotopically equivalent.
776: }
777: \label{fig-trapez}
778: \end{center}
779: \end{figure}
780:
781: \begin{Claim} We can perturb the paths output from step 1 so that
782: they become disjoint and the Bar-Yehuda and Chazelle
783: algorithm can be applied.
784: \end{Claim}
785:
786: The trapezoidization algorithm takes time $O(k + n (\log n)^{1+\eps})$,
787: which is bounded by the time taken by step 1.
788: Once we have a trapezoidization of $M$, we bundle homotopically
789: equivalent paths as follows. While scanning each $\mu\in M$, we
790: check if it is homotopically equivalent to the path ``below'' it,
791: by examining all the edges of the trapezoidization that are incident to
792: $\mu$ from below. If all these trapezoidization edges reach the same path
793: $\mu_j$ and none pass through a terminal on the way to $\mu_j$,
794: and $\mu_i$ and $\mu_j$ have the same
795: terminals as endpoints, then we mark
796: $\mu_i$ as a duplicate. Let $R=\{\rho_1\dots \rho_r \}$
797: be the paths of $M$ that are not marked as duplicates.
798:
799: \begin{Lemma}
800: The number of paths in $R$ is bounded by $2n$.
801: \end{Lemma}
802:
803:
804: \begin{proof}
805: Note that every terminal $t$ is either a right endpoint of paths in $R$
806: or a left endpoint of paths in $R$, but not both.
807: This is because a terminal cannot have local left extremes and local
808: right extremes locked at it without the paths crossing.
809:
810: For each terminal $t \in T$, associate its bottommost incident path $\phi(t)$
811: (its ``floor''), and the first path hit by a vertical ray going up from $t$,
812: $\gamma(t)$ (its ``roof'').
813: We claim that every path in $R$ is $\phi(t)$ or $\gamma(t)$ for
814: some $t \in T$. This proves that the number of paths in $R$ is at most
815: $2n$.
816:
817: Consider a path $\rho \in R$ with left and right terminals $s$ and $t$,
818: respectively. Suppose that $\rho$ is not a roof. Then every vertical
819: ray extending downward from a point of $\rho$ must hit the same path $\sigma$.
820: (If two rays hit different paths, then in the middle some ray must
821: hit a terminal.)
822: Furthermore, since $\rho$ is not the bottommost path incident to $s$,
823: $\sigma$ must hit $s$. Similarly $\sigma$ must hit $t$. But then
824: $\sigma$ and $\rho$ are homotopically equivalent.
825: \end{proof}
826:
827:
828: \section{Shortest Paths}
829:
830: In this section we find shortest paths homotopic to the $O(n)$
831: monotone paths $R = \{\rho_1, \ldots, \rho_r\}$ produced
832: in the previous section.
833: Let $\rho'_i$ denote the shortest path homotopic to $\rho_i$.
834: We route each path using a funnel technique.
835: The funnel algorithm of
836: \cite{FOCS82*339} and \cite{LP84}
837: operates on a triangulation of the $n$ points
838: (the terminals in our case), and follows the path through the triangulation
839: maintaining a current ``funnel'' containing all possible shortest paths
840: to this point.
841: The algorithm takes time proportional to
842: the number of edges in the path plus the
843: number of intersections between
844: the triangulation edges and the path.
845:
846: Rather than a triangulation, we will use a trapezoidization formed by
847: passing a vertical line through each of the $n$ terminals, see Fig.~\ref{fig-shield}(a).
848: Then, since each path $\rho_i$ is $x$-monotone, it has $O(n)$ intersections with
849: trapezoid edges, and the funnel algorithm takes
850: time $O(n + k_i)$, where $k_i$ is the number of edges in $\rho_i$.
851: This gives a total over all paths of $O(n^2 + k)$.
852: Recall that $k$ is $\max\{k_{\it in}, k_{\it out}\}$, where
853: $k_{\it in}$ is the number of edges in all the input paths,
854: and $k_{\it out}$ is the number of edges in all the output paths.
855: Note that the number of edges in $R$ is bounded by $k_{\it in\/}$.
856:
857:
858: \begin{figure}[t]
859: \begin{center}
860: {\includegraphics[width=12cm]{shield.eps}}
861: \caption{\small\sf
862: (a) A path $\rho_1$ (dashed), its funnel up to line $l$ (dotted) and the final homotopic shortest path $\rho'_1$; (b) After the shortest path $\rho'_1$ has been found, shielding allows us to route another path $\rho_2$ without examining vertical lines $l_1$ and $l_2$.
863: }
864: \label{fig-shield}
865: \end{center}
866: \end{figure}
867:
868: With respect to our whole algorithm, this time of $O(n^2 +k)$ is dominated by
869: the $O(n^{2+\epsilon})$ time required to create the range query
870: data structure in step 1.
871: However, it is interesting to see how much improvement we can make
872: in this step alone.
873: In the remainder of this section we describe a randomized algorithm to
874: route the $O(n)$ monotone paths of $R$ in time $O(n \log n + k)$, and finally
875: mention a deterministic algorithm with $O(n \sqrt n + k)$ running time.
876:
877: Both methods use a ``shielding'' technique. We begin by describing this
878: idea intuitively.
879: First note that the $\rho_i$'s can be routed independently, since
880: none affects the others.
881: The initial paths $\rho_i$ are non-crossing, and so are the final
882: shortest paths, $\rho'_i$. If $\rho_j$ is below $\rho_i$, and we have already
883: computed
884: $\rho'_j$, then $\rho'_j$ behaves as a barrier that ``shields''
885: $\rho_i$ from terminals that are vertically below $\rho'_j$, see Fig.~\ref{fig-shield}(b).
886:
887:
888:
889:
890: To utilize shielding we will modify the basic trapezoidization described above
891: as we discover shortest
892: paths $\rho'_i$. In particular, the upward vertical ray
893: through terminal $t$, $u(t)$, will be truncated at the lowest shortest
894: path $\rho'_i$ that is strictly above $t$ and does not bend at $t$.
895: The downward vertical ray through terminal $t$, $d(t)$, will be truncated
896: in an analogous way.
897:
898: The shortest paths found so far, together with the truncated vertical rays
899: $u(t)$ and $d(t)$ for each terminal $t$,
900: partition the plane into
901: trapezoids, each bounded from left and right by the vertical rays,
902: and from above and below by shortest paths.
903: To route a new path $\rho_i$ through this modified trapezoidization
904: we use the following algorithm.
905:
906: \vspace{2mm}
907: \noindent{\bf Routing $\rho_i$ with shielding}
908: \begin{enumerate}
909:
910: \item
911: Identify the first trapezoid that $\rho'_i$ will traverse. This can
912: be done in $O(\log n)$ time because the shortest paths observe the
913: same vertical ordering as the original $\rho_j$'s.
914:
915: \item
916: Traverse from left to right the sequence of trapezoids that $\rho'_i$
917: will pass through. (Note that $\rho_i$ itself may pass through different
918: trapezoids, see Fig.~\ref{fig-shield}(b).)
919: We construct the funnel for $\rho'_i$ as we do this traversal.
920: Suppose that our path enters trapezoid $\tau$. To leave $\tau$ on the right
921: we have two cases.
922: If the right side of $\tau$ is a point, then it is a
923: terminal $t$, and we are locked between
924: two paths that terminate or bend at $t$. Then the funnel collapses
925: to this point, and we proceed to the next trapezoid if $\rho_i$ continues.
926: Otherwise the right side of $\tau$ is a vertical through some terminal
927: $t$, and (unless $\rho_i$ ends at $t$)
928: we have a choice of two trapezoids to enter, the upper one with
929: left side $u(t)$ or the lower one with left side $d(t)$.
930: We follow path $\rho_i$ until it crosses the infinite vertical
931: line through $t$. If it passes above $t$ then we enter the upper
932: trapezoid, and otherwise we enter the lower trapezoid. We update the
933: funnel to include $t$.
934:
935: \item
936: When we reach the right endpoint of $\rho_i$, the funnel gives
937: us the shortest homotopic path $\rho'_i$.
938:
939:
940: \item We update the trapezoidization as follows.
941: For each vertical segment $u(t)$ or $d(t)$ that is
942: intersected by $\rho'_i$
943: we chop the segment
944: at its intersection point with $\rho_i'$,
945: provided that the intersection point is not $t$
946: (i.e. that $\rho_i'$ does not bend at or terminate at $t$).
947:
948: \end{enumerate}
949:
950: Without yet discussing the order in which we route the paths,
951: we can say a bit about the timing of this shielding method.
952: As we traverse a path $\rho_i$ we spend time proportional to the
953: size of $\rho_i$ plus the number of trapezoids traversed by $\rho'_i$.
954: When $\rho'_i$ leaves a trapezoid, say at the line segment $u(t)$
955: above terminal $t$, it may happen that $\rho'_i$ will bend at
956: $t$ or terminate at $t$. In this case $t$ is part of the output path
957: $\rho'_i$, and we can charge the work for this trapezoid to the output
958: size. If, on the other hand, $\rho'_i$ does not bend or terminate
959: at $t$, then it crosses $u(t)$ and we chop $u(t)$ there.
960: In this case we charge the work for this trapezoid to the chop.
961: Thus the total time spent by the algorithm is $O(k + C)$
962: where $C$ is the total number of chops performed at the $n$ verticals.
963:
964: For shielding to be effective
965: we need to route paths in an order
966: that makes $C$ grow more slowly than $n^2$.
967: We first analyze the randomized algorithm where we
968: choose the next path to route at random with uniform
969: probability from the remaining paths.
970:
971: \begin{Claim}
972: If paths are routed in random order then
973: the expected number of times we chop a segment $u(t)$ or $d(t)$ is
974: $O(\log r)$, and thus $C$ is $O(n \log n)$, and the routing takes time
975: $O(k + n \log n)$.
976: \end{Claim}
977:
978: \begin{proof}
979: This follows from a standard backward analysis.
980: See for example \cite{cg-book-00} for other proofs along these lines.
981: Let $l$ be a vertical line through a point $t$,
982: and let $u$ denote a ray emerging
983: vertically from $t$. Assume that $m$ paths
984: intersecting $u$ have been inserted up to now, and we
985: are about to insert a new one. Then $u$ will be chopped if and only if
986: the new path creates an intersection point below all existing
987: intersection points on $u$, but above $t$ itself.
988: Since the order of the
989: insertions is random, the probability of the new intersection point being
990: below all other intersection points is $1/m$. Summing
991: over all paths yields the claimed bound.
992: \end{proof}
993:
994: Finally, we mention that we can achieve a routing time of $O(k + n \sqrt n)$
995: deterministically. Suppose that the paths $\{\rho_1, \ldots, \rho_r\}$
996: are in order from top to bottom. (We get this for free from step 2 of our algorithm.) Partition the paths into blocks $B_1, \ldots, B_{\sqrt r}$ each
997: of size $\sqrt r$, and route them one block at a time from $B_{\sqrt r}$ to $B_1$. Within each block we process the paths in order.
998: Since the largest increasing [decreasing] sequence with this ordering
999: has size $\sqrt r$, therefore the number of chops at each vertical
1000: is $\sqrt r$. Thus $C$ is $O(n \sqrt n)$, and this routing method takes
1001: time $O(k + n \sqrt n)$.
1002:
1003: \section{Conclusion and Open Problems}
1004:
1005: For any set of $n$ disjoint paths joining pairs of terminals in the plane
1006: we can find shortest paths homotopic
1007: with respect to the set of terminals
1008: in time $O(n^{2+\eps} + k\log^2 n)$ where $k$ is the sum of input and output
1009: sizes of the paths.
1010: If $k$ is larger than $n$ this is better than the
1011: Hershberger-Snoeyink algorithm which runs in time $O(nk)$.
1012:
1013: More generally, we can use any other range search method, and
1014: obtain a running time of $O(P + kQ + n (\log n)^{1+\eps} + T)$
1015: where $P$ is the preprocessing time for the range search data structure
1016: on $n$ points, $Q$ is the time for a simplex optimization query (find the
1017: minimum/maximum $x$-coordinate point in a triangle), and $T$ is the
1018: time for the shortest path method of step 3---$O(n \log n)$ randomized,
1019: or $O(n \sqrt n)$ deterministic.
1020: Whether $k$ is large or small compared to $n$ determines which
1021: trade-off between $P$ and $Q$ is preferred.
1022: For example, the partition tree method of
1023: Matou{\v s}ek \cite{Mat93} yields an emptiness
1024: query time of $O(\sqrt n)$ with near-linear time preprocessing,
1025: and would be preferable for $k=O(n^{3/2})$.
1026: With any approach to range searching, it may be possible to improve
1027: the query time by taking into account the fact that one of the edges
1028: of each query triangle is vertical.
1029:
1030: Another open problem is whether we can do without range queries, and
1031: somehow use a trapezoidization of the original paths, since this can
1032: be found so efficiently with the Bar-Yehuda and Chazelle algorithm.
1033:
1034:
1035:
1036: {\small
1037: \bibliographystyle{abbrv}
1038: \bibliography{stephen}
1039: }
1040: \end{document}
1041:
1042:
1043:
1044: