key: cord-0200542-6nnktpjd authors: Filtser, Omrit; Goswami, Mayank; Mitchell, Joseph S.B.; Polishchuk, Valentin title: How to Stay Socially Distant: A Geometric Approach date: 2022-03-09 journal: nan DOI: nan sha: a88a95ce9a90c184bb67ab985ebe575d1e8f70f9 doc_id: 200542 cord_uid: 6nnktpjd We introduce the notion of social distance width (SDW) in geometric domains, to model and quantify the ability for two or more agents to maintain social distancing while moving within their respective, possibly shared, domains. We first study the social distance width of two polygonal curves in one and two dimensions, providing conditional lower bounds and matching algorithms. We then consider social distance width among polygons, which measures the minimum distance that two agents can maintain while restricted to travel in or on the boundary of the same polygon. We investigate several variants of the problem in this setting, for some of which we provide linear time algorithms. We draw connections between our proposed social distancing measure and existing related work in computational geometry, hoping that our new measure may spawn investigations into further interesting problems that arise. The COVID-19 pandemic has raised many new challenges in various fields of research. In this paper we present a new set of problems, inspired by the challenge of maintaining social distance among groups and individuals. We introduce the notion of social distance width (SDW) in geometric domains as a way to measure the extent to which two (or more) agents can move within a domain while maintaining a minimum separation, e.g., for social distancing or for other situations in which separation is important. In general, we are given k agents and k associated domains. Each agent is restricted to move only within its respective domain, and at least one of the agents has some mission, e.g., to move from a given start point to a given end point, or to traverse a given path inside the domain. In addition, the domains may be shared or distinct, and different agents may have different speeds. The goal is to find a movement strategy for all the agents, such that the minimum pairwise distance between the agents at any time is maximized. Additionally, one may seek to minimize the time necessary to complete one or more missions. In this paper, we (mostly) consider the case of k = 2, i.e., two agents, "Red" and "Blue", are moving inside their given domains. Further, in this paper, unless stated otherwise, we do not consider speed to be a limiting factor; e.g., when Blue moves in order to maintain distance from Red, we assume that Blue can move at a sufficient speed. We begin by considering the scenario in which the two domains are polygonal curves R and B. The agents' missions are to traverse their respective curves, from the start point to the end point, in order to maximize the minimum distance between the agents. The Social Distance Width (SDW for short) of the two curves is the maximum separation that can be maintained. In Section 2 we consider both the continuous case (agents move continuously along the edges of their curves), and the discrete case (agents "jump" between consecutive vertices of their curves). Interestingly, these notions of SDW for curves are "flipped" notions of the well studied continuous and discrete Fréchet distances (see related work below), in which the restrictions on the movement are similar, but the objective is "flipped": the agents want to minimize the maximum distance between them. We first show that the continuous SDW between two n-vertex curves in one dimension (1D) can be computed in near-linear time. This is in sharp contrast with continuous Fréchet distance, which has quadratic conditional (SETH-based) lower bounds [BM16] . We then develop quadratic or near-quadratic time algorithms for computation of discrete SDW and 2D continuous SDW. Finally, we complement our quadratictime algorithms with (SETH-based) conditional lower bounds, even for approximation: we give a quadratic conditional lower bound on approximating SDW for curves in 2D up to a factor better than √ 5 2 √ 2 , and a quadratic conditional lower bound on approximating discrete SDW for curves in 1D, with a factor better than 2 3 . While the case in which the two agents are restricted to move on given polygonal curves in the plane has quadratic lower bounds (and quadratic-time algorithms), we are able to achieve linear time algorithms in certain natural situations in which one agent has more flexibility in its motion, while still being geometrically restricted. In particular, we examine the scenario in which Blue is not restricted to move along some given curve; rather, it can choose its own path. Of course, if Blue had no restrictions at all, it could just go to infinity and thus be far from Red (on any path). We therefore restrict the domain for Blue to a simple polygon P , and measure separation using geodesic distance in P . In Section 3 we consider two such scenarios for which we present linear time algorithms. In the first, the Red agent has a mission to walk along a given (shortest) path inside the polygon. The Blue agent must stay as far as possible from the Red, and the only restriction is to move only inside P . This is related to the motion planning problem in which we are given a set of disjoint bodies (e.g., disks), and we seek a motion plan that allows them to remain disjoint while each moves to a destination. The second scenario within a simple polygon P has the Red agent on a mission to traverse the boundary of P , while the Blue agent moves within P (with a starting point of Blue's choice), in order to maximize the minimum Red-Blue distance. We define the social distance width (SDW for short) of a polygon P to be the minimum Red-Blue distance that can be maintained throughout the movement, maximized over all possible movement strategies. We show that when P is a skinny polygon (a tree), a strategy for Blue can be computed in linear time. Related Work. The Fréchet distance is an extensively investigated distance measure for curves, starting with the early work of Alt and Godau [AG95] . There is a quadratic-time algorithm for computing it [EM94, AG95] , and it was recently shown [Bri14] that under the Strong Exponential Time Hypothesis (SETH), no subquadratic algorithm exists, not even in one dimension [BM16] . Moreover, under SETH, no subquadratic algorithm exists for approximating the Fréchet distance within a factor of 3 [BOS19] . The best known approximation algorithm for Fréchet distance is an α-approximation, running in O((n 3 /α 2 ) log n) time [CF20] , and in O(n log n + n 2 /α 2 ) time for the discrete version [CR18] . There is an extensive literature on related problems of motion planning in robotics. Perhaps most closely related to our work is that of coordinated motion planning of 2 or more disks; see Demaine et al. [DFK + 19], on nearly optimal (in terms of lengths of motions) rearrangements of multiple unit disks and the related work of [HH02] . (In our problems, instead of minimizing length of motion for given radius disks, we seek to maximize the radii.) The problem of computing safe paths for multiple speed-bounded mobile agents that must maintain separation standards arises in air traffic management (ATM) applications. Arkin et al. [AMP10] studied the problem of computing a large number of "thick paths" for multiple speed-bounded agents, from a source region to a sink region, where the thickness of a path models the separation standard between agents, and the objectives are to obey speed bounds, maintain separation, and maximize throughput. (In our problems, we are not maximizing a "throughput"; rather, we maximize a separation standard, for a given set of agents.) In the maximum dispersion problem, the goal is to place n (static) points within a domain P in order to maximize the minimum distance between two points. (Optionally, one may also seek to keep points away from the boundary of P .) An optimal solution provides maximum social distancing for a set of static agents, who stand at the points, without moving. Constant factor approximation algorithms are known [BF01, FM04] . (The problem is also closely related to geometric packing problems, which is a subfield in itself.) In robotics, the problem of motion planning in order to achieve well dispersed agents has also been studied: move a swarm of robots, through "doorways", into a geometric domain, in order to achieve a set of agents well dispersed throughout the domain. Such movements can be accomplished [HAB + 02] using local strategies that are provably competitive. In the adversarial setting, in which one or more agents is attempting to move in order to avoid (evade) a pursuer, there is considerable work on pursuit-evasion in geometric domains (e.g., the "lion and man" problem); see the survey [CHI11] . In this section the domains of Red and Blue are two polygonal curves R and B, respectively. We begin by giving some basic definitions; then, we describe tools that were used in classic algorithms for Fréchet distance and the relation to the social distancing problem for curves. A polygonal curve P in R d is a continuous function P : [1, n] → R d , such that for any integer 1 ≤ i ≤ n − 1 the restriction of P to the interval [i, i + 1] forms a line segment. We call the points P [1], P [2], . . . , P [n] the vertices of P , and say that n is the length of P . For any real numbers α, β ∈ [1, n], α ≤ β, we denote by P [α, β] the restriction of P to the interval [α, β]. Then, for any integer The well-studied Fréchet distance between P and Q is inf τ =(f,g) max t∈[0,1] P (f (t)) − Q(g(t)) , where τ is a traversal of P and Q. The discrete case. When considering discrete polygonal curves, we simply define a polygonal curve P as a sequence of n points in R d . We denote by P [1], . . . , P [n] the vertices of P , and for any Consider two sequences of points P, Q of length n and m, respectively. A traversal τ of P and Q is a sequence, (i 1 , j 1 ), . . . , (i t , j t ), of pairs of indices such that i 1 = j 1 = 1, i t = n, j t = m, and for any pair (i, j) it holds that the following pair is (i, j + 1), (i + 1, j), or (i + 1, j + 1). Definition 2 (Discrete Social Distance Width). The discrete social distance width (dSDW) of P and Q is dSDW (P, Q) = max τ min (i,j)∈τ Notice that unlike in the continuous case, the distances between the agents are only calculated at the vertices of the polygonal curves. The discrete Fréchet distance (DFD) between P and Q is min τ max (i,j)∈τ P [i] − Q[j] , and it can be computed in O(nm) time [EM94] using a simple dynamic programming algorithm. From now on, we assume for simplicity that both curves R and B have length n; however, our algorithms and proofs can be easily adapted to the general case of m = n. We give (Section 2.1) a near-linear algorithm to compute the continuous SDW in 1D, demonstrating that "flipping" the objective function makes this setting easier: for continuous Fréchet there exist conditional quadratic lower bounds [BM16] . We give quadratic algorithms and then conditional lower bounds (Sections 2.2 and 2.3) for computing or approximating other variants (1D discrete, 2D continuous and discrete) of SDW, specifically: • a quadratic lower bound, conditioned on the Strong Exponential Time Hypothesis (SETH), on approximating SDW for curves in 2D, with approximation factor √ 5 2 √ 2 . • a quadratic lower bound, conditioned on the Strong Exponential Time Hypothesis (SETH), on approximating dSDW for 1D curves, with approximation factor 2 3 . 4 Consider the decision version of the SDW problem in 1D: Given two paths, R and B, on the x-axis, each specified by n points, we are to determine if it is possible to find a traversal of the two paths so that Red and Blue maintain separation larger than δ during their traversals. We assume, w.l.o.g., that R[1] < B[1]. We can also assume that B[1] − R[1] > δ, as otherwise we can simply return NO. Notice that it suffices to consider the problem of maintaining separation at least 0 between R and a shifted (by δ) copy of B; we seek to determine if SDW (B, R) > 0. Let b max be the rightmost point of B and let r min be the leftmost point of R. Lemma 3. If SDW (B, R) > 0, then: (i) All of R must be to the left of b max , and all of B must be to the right of r min . (ii) While Blue is at b max , any subpath of R can be traversed by Red. While Red is at r min , any subpath of B can be traversed by Blue. (iii) There exists a traversal achieving SDW (B, R) > 0 such that at some point Blue is at b max and Red is at r min . Proof. (i) holds by continuity: if R has a point to the right of b max , Red must cross Blue before getting to that point. The claim for B is symmetric. (ii) then follows from (i). For (iii), consider a traversal τ , and assume that Blue reaches b max before Red reached r min . Let r be the location of Red when Blue is at b max ; r does not have to a be a vertex of R, but in any case r precedes r min along R. Let b ∈ B be Blue's location at the time Red reaches r min (b is after b max ). By (ii), while Blue is at b max , Red can go from r to r min -so (b max , r min ) becomes part of the traversal. Again by (ii), while Red is at r min , Blue can go from b max to b . From (b , r min ), Blue and Red can follow τ to complete the traversal. Lemma 3 allows us to assume, w.l.o.g., that b max and r min are the first points of B and R, respectively (i.e., B[1] = b max , R[1] = r min ): for arbitrary B, R we can separately solve the problem for the subpaths of Blue from b max to B[n] and Red from r min to R[n], and the problem for the (reversed) subpaths of Blue from b max to B[1] and Red from r min to R[1]. Let b min (resp., r max ) be the leftmost (resp., rightmost) x-coordinate of B (resp., R). If b min ≤ R[1], or r max ≥ B[1], then by Lemma 3 (i) we get SDW (B, R) = 0. In addition, if b min > r max , then we see that SDW (B, R) > 0, since the x-coordinates of the paths do not overlap. We are thus left with the case in which R[1] < b min ≤ r max < B[1] (Figure 1) Let B + be the last vertex on the Blue path such that B + > r max . Notice that such a vertex always exists because B[1] > r max . Let R − be the leftmost vertex on the Red path after it visits r max for the last time. is always possible because B + is to the right of r max . Now consider a traversal τ achieving SDW (R, B) > 0. We show how to complete τ to a traversal achieving SDW (R, B) > 0. If in τ Red visits R − before Blue visits B + , then let r 1 be the location of Red when Blue is at B + . Since B + is to the right of r max , in τ we can have Red traverse the path from R − to r 1 while Blue is at B + . Then, continue as in τ to complete the traversal. Else, in τ Blue visits B + before Red visits R − . Let b 1 be the location of Blue when Red is at R − , and let b 2 be the location of Blue when Red is at r max in the traversal τ . In τ , Blue traverses the subpath from b 2 to b 1 while Red traverses the subpath from r max to R − . Now, since R − is the leftmost point on the subpath from r max to R − , Blue can traverse the subpath from b 2 to b 1 while Red is at R − . Notice that b 2 either precedes B + , or it is on the edge incident to B + . Therefore, in τ we can have Blue traverse the subpath from B + to b 1 while Red is at R − . Again we continue as in τ to complete the traversal. By the above lemma, we can simply use the following traversal: Blue traverses B from The situation now is: Blue is at B + and the subpath of Blue starting at B + is entirely to the left of B + (because B[n] ≤ r max ); Red is at R − and the subpath of Red starting at R − is entirely to the right of R − . Also note that R − is not the first vertex of R. We are thus back to our initial conditions, and can apply the algorithm recursively. More formally, consider the following recursive algorithm. Given two curves R, B such that Running time. We begin with a preprocessing step, where we sort the vertices of R and B. For the decision algorithm, given a value δ, we merge the sorted lists of R and B − δ in linear time. Then, we can compute in linear time: (i) The leftmost and rightmost vertices that follow each vertex of the curve (this can be done in a single scan of the curve). (ii) For each vertex r of R, the last vertex of B that is located to the right of r. In each recursive step of the algorithm, we can compute the points b min , r max , B + , and R − , in linear time. Thus, the total running time for the decision procedure is O(n). For the optimization (finding the maximum δ that allows separation), we note that the maximum separation is achieved when Red and Blue are on vertices, because otherwise, their distance can increase by having one of them wait on a vertex. Thus, for finding the maximum possible δ, we can do a binary search among the O(n 2 ) different distances, using distance selection at each step in O(n log n) time. The distance selection algorithm stores all O(n 2 ) distances implicitly in a sorted matrix, and then applies the sorted matrix selection algorithm of [FJ84] in O(n log n) time. Theorem 5. Given two polygonal curves P, Q of length n in 1D, their social distance width, SDW (P, Q), can be computed in O(n log 2 n) time. Our algorithm generalizes to the case of ≥ 3 agents (see Section 4). Computing the continuous SDW (R, B) can be done using the notion of a free-space diagram, defined in [AG95] . For the discrete version, a simple dynamic programming algorithm (similar to the one known for discrete Fréchet distance [EM94] ) gives a O(n 2 ) solution. More details are given in Appendix A. We thus obtain the following theorems. Theorem 6. There is an O(dn 2 log n) time exact algorithm for computing the SDW of two polygonal n-vertex curves in R d . Theorem 7. There exists an O(dn 2 ) time exact algorithm for computing the dSDW of two polygonal n-vertex curves in R d . In Section 4 we also discuss other interesting versions of the problem that admit quadratictime algorithms. Bringmann and Mulzer [BM16] give a lower bound (conditioned on SETH) for computing the discrete Fréchet distance between two curves in 1D, using a reduction to the Orthogonal Vectors (OV) problem. We prove similar results below for SDW in 2D and dSDW in 1D. The Orthogonal Vectors problem is defined as follows. Given two sets denotes the kth coordinate of u i ). Bringmann and Mulzer [BM16] showed that if OV has an algorithm with running time D O(1) · N 2−ε for some ε > 0, then SETH fails. In the following, by an algorithm with approximation factor α < 1 we mean an algorithm that outputs a traversal whose maintained separation distance is at least α times the SDW, given by an optimal traversal. We first show that for continuous SDW, increasing the dimension from 1D (where we gave a near-linear-time algorithm) to 2D likely rules out subquadratic algorithms. Theorem 8. [SDW Lower Bound in 2D] There is no algorithm that computes the SDW between two polygonal curves of length n in the plane, up to an approximation factor at least Moreover, if SDW can be approximated up to a factor of α, then again we get that OV can be decided in D O(1) · N 2−ε time, and SETH fails. As in [BM16] , we assume that D is even (otherwise add a 0 coordinate to each vector). The construction of R (resp. B) is such that for each vector u i ∈ U (resp. v j ∈ V ), we construct a vector gadget curve A i (resp. B j ), such that if u i and v j are orthogonal then SDW (A i , B j ) = 1, and otherwise SDW (A i , B j ) ≤ α. Then, we connect the vector gadgets into curves R and B. Consider the following set of points (see Figure 2 ): • Notice that all the points are located on a regular grid with side length 0.25. Let α = √ 5 2 √ 2 , and notice that s Similarly, for v j ∈ V , the gadget B i is constructed as follows: It is easy to see that if u i , v j are orthogonal then SDW (A i , B j ) = 1, because the traversal that uses "antipodal" points maintains distance 1 between Red and Blue. For the other direction, we claim that if SDW (A i , B j ) > α, then u i , v j are orthogonal. Now assume that u i (1) = 1, so R starts with r , p 7 , p 8 , u, c u 1 . Notice that when Blue traverses the subcurve b , p 3 , p 4 , d, Red cannot reach c u 1 . If v j (1) = 1, then the next move of Blue is toward c d 1 , and the distance between the agents becomes at most α (if Red in on p 8 while Blue is on c d 1 then their distance is exactly α). This means that u i (1) = v j (1) = 1 is not possible. Therefore, at least one of Notice that Blue will visit d for the first time before Red visits d for the first time. Similarly, Red will visit u for the first time before Blue visits u for the first time. Moreover, Red cannot reach r before Blue leaves d, and Blue cannot reach b before Red leaves u. Thus, the movement of Red and Blue is synchronized in the sense that when Red is moving from u towards d, Blue is moving from d towards u, and vice versa. Hence, by similar (symmetric) arguments, we get that u i (k) = v j (k) = 1 is not possible for all k = 2, . . . , D as well, and u i , v j are orthogonal. The gadgets A i and B j are connected into R and B as follows: while Red stays at x, then Blue moves to s 1 . Now Red moves from x to (0, 0), to s 2 , then traverses k=1,...,i−1 (r • A k ), and moves to r just before A i . Now Blue moves to b just before B j , and they traverse A i and B j in sync, keeping distance ≥ 1. Now Red moves to r while Blue moves to b, then Blue moves to t 1 . While Blue is on t 1 , Red traverses k=i+1,..., For the converse, assume by contradiction that SDW (R, B) > α but no u i ∈ U, v j ∈ V are orthogonal. When Red reaches (0, 0) for the first time, Blue must be on s 1 or t 1 (or on the edge between them). If Blue is on t 1 , then it must move towards s 1 before Red can continue to s 2 ; moreover, when Red reaches s 2 Blue can only be strictly above the x-axis either on the edge (t 1 , s 1 ) or (s 1 , b) . Thus we can assume that when Red is on s 2 , Blue is on s 1 immediately before some vector gadget B j . Now consider the first time when Red reaches t 2 . At this time, Blue can be either near t 1 (strictly below the x-axis) or near c d 0 . However, if Blue is near c d 0 , it is not possible for the agents to continue their movement: Blue cannot reach d and Red cannot reach (0, 0). Thus we can assume that when Red reaches t 2 , Blue is near t 1 and strictly below the x axis. We conclude that between the first time that Red visited s 2 and the first time that Red visited t 2 , Blue had to traverse the vector gadget B j in order to get from a point strictly above the x axis to a point strictly below it. Before Blue starts traversing B j , it first visits b, but when Blue is on b, the only possible location of Red is near r (more precisely, on the edge between r and r , but not on r ). Notice that Red cannot be near x since it has not visited t 2 yet. Now there are two options: (1) Red is immediately before some vector gadget A i , and thus by previous arguments u i and v j are orthogonal, or (2) Red has finished all its vector gadgets, and it waits on r while Blue traverses B j . In this case, notice that since r − c u 1 = r − c d 1 = α, Blue cannot reach any of c u 1 , c d 1 while Red is on r; thus, v j must be a 0-vector, implying u i and v j are orthogonal. , which means that OV can be decided in D O(1) · N 2−ε time, and SETH fails. Moreover, if dSDW can be approximated up to a factor of 2/3, then again we get that OV can be decided in D O(1) · N 2−ε time, and SETH fails. Again as in [BM16] we assume that D is even. Consider the following set of points on the real line (see Figure 3 ): w 1 = −w 2 = 5/3, We first construct vector gadgets. For each u i ∈ U , we create a subsequence A i of R: for odd (resp. even) k, the kth point in A i is a o u i (k) (resp. a e u i (k) ). Similarly, for v j ∈ V , we create a subsequence B j of B, using bs instead of as. It is easy to see that Red and Blue can traverse B j and A i while maintaining distance 1 if and only if u i , v j are orthogonal (they jump between odd and even points in sync, "opposite" each other, and at least one of them is at "far" point, indexed with 0). Note that any such vector gadget has length D. The gadgets B j are connected into B as follows: Let W be the sequence of D(N − 1) points that alternate between a o 0 and a e 0 starting with a o 0 (Red can traverse each of N − 1 length-D subpaths of W in sync with Blue on any B j ). We construct R as follows: The proof that OV is a Yes instance if and only if dSDW (R, B) ≥ 1 is similar to that in [BM16] , with an important change: here, we also show that if OV is a No instance, then dSDW (R, B) ≤ 2/3. Indeed, notice that since dSDW (R, B) is determined by the distance between two vertices, one from R and one from B, we get that if dSDW (R, B) > 2/3, then necessarily dSDW (R, B) ≥ 1 (as there are no two points in our construction with distance in the range (2/3, 1)). Therefore, its is enough to show that if OV is a No instance, then dSDW (R, B) < 1. If u i ∈ U, v j ∈ V are orthogonal, then Red traverses D(N −j) points on W while Blue stays at w 1 , then Blue traverses B 1 . . . B j−1 in sync with Red traversing the rest of W . Now, while Blue stays at w 1 before B j , Red goes to x 1 and traverses A 1 . . . A i−1 , then goes to s before A i . Then, A i , B j are traversed in sync, Blue stays at w 2 while Red completes the traversal of A i+1 , . . . , A N and goes to x 2 , and finally Blue can complete the traversal of B j+1 , . . . , B N in sync with Red traversing the second W gadget. When Blue goes to w 2 , Red is able to complete the traversal of W . For the converse, assume by contradiction that dSDW (R, B) ≥ 1 but no u i ∈ U, v j ∈ V are orthogonal. When Red is on x 1 , Blue must be to the right of s, but if Blue is not on w 1 , then they cannot take the next step -so Blue must be on w 1 , right before some vector gadget B j . Immediately after leaving w 1 , Blue gets to b o 0 or b o 1 , implying that Red must be at a o 0 or a o 1 , i.e., either in some vector gadget A i or on the second W (since it already passed x 1 ). However, if it is on W , it must have gone through x 2 which is too close to w 1 , so Red is in A i . Now while they are on A i and B j , Red and Blue must jump in sync, until one of them reaches the end point of their respective vector gadget. Therefore, if Red did not start on the first point of A i , then it will finish A i and appear at s before Blue has finished B j . This means that A i and B j where traversed simultaneously, and since dSDW (R, B) ≥ 1, the respective vectors have to be orthogonal, a contradiction. In this section we consider distancing problems in which the given domain (for both Red and Blue) is a simple polygon. Since the two agents are moving inside the same polygon, it is natural to consider geodesic distance (i.e., the shortest path inside the polygon) instead of Euclidean distance to measure separation. Consider a scenario in which Red and Blue have to traverse two polygonal paths R and B, both inside a given polygon P , and their goal is to find a movement strategy (a traversal) that maintains geodesic distance of at least δ between them. For the analogous Fréchet problem (Red and Blue have to maintain geodesic distance of at most δ), Cook and Wenk [CW10] presented an algorithm that runs in O(n 2 log N ) time, where N is the complexity of P and n is the complexity of R and B. Their algorithm is based on the fact that the free space in a cell of the diagram is x-monotone, y-monotone, and connected. Then the geodesic decision problem can be solved by propagating the reachability information through a cell in constant time, as for the Euclidean Fréchet distance. Thus, we can apply a similar "flipped" algorithm for computing the SDW (R, B) under geodesic distance in nearly quadratic time. When both Red and Blue are restricted to traverse a given path, it seems that the Fréchetlike nature of the problem leads to near-quadratic time algorithms. Thus, in this section we consider the scenario where Blue has more freedom, and it is not required to traverse a given path. We describe two variants for which we present linear time algorithms; first is where Red is walking along a shortest path in the polygon, and second is where Red is traversing the boundary of a skinny polygon (a tree). Assume that Red moves along a geodesic path R in P (Red is on a mission and does not care about social distancing) while Blue may wander around anywhere within P starting from a given point b. We show that the decision problem, whether Blue can maintain (geodesic) social distance at least 1 from Red, can be solved in linear time. Theorem 10. Let P be a polygon with n vertices, b a point in P , and R a geodesic shortest path between two points r and r in P . There exists an O(n)-time algorithm to decide whether there exists a path B in P starting from b, such that SDW (R, B) > 1 under geodesic distance. Proof. We use |ab| to denote the geodesic distance between points a, b ∈ P . For a point t ∈ R let D t = {p ∈ P : |tp| ≤ 1} be the unit geodesic disc centered on t; let M = ∪ t∈R D t be the set of points within geodesic distance 1 from R (Figure 4, left) . Without loss of generality, assume b / ∈ D r (otherwise separation fails from the start). The disk D r splits P into connected components (a component is a maximal connected subset of P \ D r ): Blue can freely move inside a component without intersecting D r ; in particular, if the component P b of b is not equal to M \ D r (i.e., if P \ M = ∅), then Blue can move to a point in P \ M (a safe point) and maintain the social distance of 1 from Red (existence of a safe point can be determined by tracing the boundary of M ). The next lemma asserts that the existence of such a safe point is also necessary for Blue to maintain the distance of 1. Lemma 11. If P = M \ D r , then there is no traversal for Blue that maintains distance at least one from Red. Proof. Indeed, as Red follows R, D t sweeps M ; let S t ⊆ M be the points swept (at least once) by the time Red is at t ∈ R and let U t = M \ S t be the unswept points. Since b / ∈ D r = S r , initially Blue is in the unswept region. Assume that there is no safe point (P = M \ D r ) and yet Blue can escape. Suppose Blue can escape from the unswept to swept when Red is at t ∈ R (Figure 4, right) . Then there exists a point p on the boundary between U t and S t that is further than 1 from t, say |pt| = 1 + ε for some ε > 0. Since p is on the boundary of S t , at some position t * ∈ π before t, we had |t * p| = 1. Since p is on the boundary of U t , there exists an unswept point p ∈ U t within distance less than ε from p: |p p| < ε. Finally, since U t = M \ S t is part of M , p becomes swept when Red is at some point t ∈ π after t: |t p | ≤ 1. We obtain that there are three points t * , t, t along a geodesic path π and a point p such that |t * p| ≤ 1 < 1 + ε = |tp| and |t p| ≤ |t p | + |p p| < 1 + ε = |tp|, contradicting the fact that the geodesic distance from a point to a geodesic path is a convex function of the point on the path [PSR89, Lemma 1] (this is the place where we use that R is a geodesic path: if R is not geodesic, it is not necessary for the Blue to escape from M while Red is at r. See also the discussion in section 4). We now show how to implement our solution to the decision problem in O(n) time. To build the geodesic unit disk D r we compute the shortest path map (SPM) from r (the decomposition of P into cells such that for any point p inside a cell the shortest r-p path has the same vertex v of P as the last vertex before p) -the SPM can be built in linear time [GH89] ; then in every cell of the SPM we determine the points of D r : any cell is either fully inside D r , or fully outside, or the boundary of the disk in the cell is an arc of the radius-(1 − |rv|) circle centered on the vertex v of P . The set M can be constructed similarly, using SPM from R. To build the SPM, we decompose P by drawing perpendiculars to the edges of R at every vertex of the path ( Figure 5 ): in any cell of the decomposition, the map can be built separately because the same feature (a feature is a vertex or a side of an edge) of R will be closest to points in the cell (the decomposition is essentially the Voronoi diagram of the features). In every cell, the SPM from the feature can be built in time proportional to the complexity of the cell (the linear-time funnel algorithm for SPM [GH89] works to build the SPM from a segment too: the algorithm actually propagates shortest path information from segments in the polygon). Since the total complexity of all cells is linear, the SPM is built in overall linear time. After D r and M are built, we test whether b ∈ D r (if yes, the answer is No) and trace the boundary of M to determine the existence of a safe point (by Lemma 11, the answer is Yes iff such a point exists). In this section we consider the case in which the shared domain of Red and Blue is a tree T , and the distance is the shortest-path distance in the tree (the distance between vertices u and v denoted |uv|). Red moves around T in a depth-first fashion: there is no start and end point, it keeps moving ad infinitum. In particular, if T is embedded in the plane, the motion is the limiting case of moving around the boundary of an infinitesimally thin simple polygon, and the distance is the geodesic distance inside the polygon. Theorem 12. Let T be a tree with n vertices, embedded in the plane, and R be a traversal of T in a depth-first fashion. There exists an O(n)-time algorithm to find a path B in T that maximizes SDW (R, B) under the geodesic distance. Proof. We start with the case when T is a star (Figure 6 , left). Let r be the root of the star and let |ra| ≥ |rb| ≥ |rc| be the 3 largest distances from r to the leaves (i.e., the distance to the root from all other leaves is at most |rc|). Assume that the leaves a, b, c are encountered in this order as Red moves around T (this assumption is w.l.o.g., since the other orders are handled similarly); we call r and |rc| the 2-outlier center and radius of T because allowing 2 outliers, |rc| is the smallest radius to cover T with a disk centered at a vertex of the tree. Now, on the one hand, Blue can maintain distance |rc| from Red: when Red is in a Blue is in c, when Red is in b Blue moves to a, when Red is in c Blue moves to b; the minimum distance of |rc| is achieved when Blue is at c. On the other hand, the distance must be at least |rc| at some point because Blue cannot sit at a or at b all the time, and while it moves from a to b through r, Red must be somewhere else (not at a or b) . We now consider an arbitrary tree T . Let r ∈ T be a vertex. Removal of r disconnects T into several trees; for a vertex v = r of T let T v v be the tree of v. Let a be the vertex of T furthest from r, let b be the vertex of T \ T a furthest from r, and let c be the vertex of Figure 7 : Left: If |uv| = |u v | = D, then |uww v | > D. Right: The distance from any diameter endpoint to the closest endpoint of π (thick) is the d, for otherwise one of the diameters is longer than another. The 2-outlier radius of r is d, while the 2-outlier radius of r cannot exceed d. T \ T a \ T b furthest from r (Figure 6, right) . Call |rc| the 2-outlier radius of r, and assume r * is the vertex whose 2-outlier radius is the largest. As in a star, Blue can maintain the distance of |r * c| from Red by cycling among a, b, c "one step behind" Red. Also as in a star, a larger distance cannot be maintained because, again, Blue has to pass through r * on its way from a to b, and the best moment to do so is when Red is at c. To find r * in linear time, note that ab is a diameter of T : it is a longest simple path in T . All diameters of a tree intersect because if two diameters uv, u v do not intersect, then there exist vertices w ∈ uv, w ∈ u v that connect the two diameters and the distance from each of w, w to one of the endpoints of its diameter is at least half the diameter, implying that the distance between these endpoints is strictly larger than the diameter (Figure 7, left) . Moreover, since the tree has no cycles, the intersection of all its diameters is a path π in T . Notice that the distance from any diameter endpoint to the closest point on π is the same (call it d). We claim for any point r not on π, the point r on π closest to it has a larger 2-outlier radius, and thus r * may be found on π. Indeed, let T r be the tree that contains r after removing r , and let v be the farthest point from r not in T r . Since |r v| is strictly smaller than the distance between r and the closest diameter endpoint (See Figure 7 , right), we get that the 2-outlier radius of r is at most |r v|. On the other hand, the 2-outlier radius of r is at least |rv|, and clearly |rv| > |r v|. We thus compute a diameter ab (linear time) and pick the vertex with the largest 2-outlier radius on the diameter as r * by checking the vertices one by one. As we check consecutive vertices on ab, the distances |ra| and |rb| are updated trivially, and the subtrees T \ T a \ T b are pairwise-disjoint for different vertices r along the diameter; thus the longest paths in all the subtrees can be computed in total linear time. We remark that the above solution extends directly to weighted trees and to the version in which the distance is measured between arbitrary points on edges of T (in this version, the 2-outlier center may lie in the middle of an edge). A discussion on more variants of the problem can be found in Section 4. We have introduced the notion of social distancing width (SDW) of polygonal curves and studied the complexity of computing it when there are k = 2 agents. For continuous SDW in 1D we presented a near-linear time algorithm, which is somewhat surprising, as the analogous Fréchet problem has a quadratic conditional lower bound. Another interesting extension is that this algorithm generalizes to any number k ≥ 2 of agents, with a running time of O(kn log n), as follows. More than 2 agents in 1D. Let A 1 , A 2 , . . . , A k be the k polygonal paths of the agents (all in 1D). Given a distance value δ, our goal is to decide whether the k agents can traverse their respective paths while maintaining distance δ from one another. Since we are on the line and agents cannot cross paths, we only need to maintain distances for neighboring agents. Therefore, we can translate each A i by −(i − 1)δ (for 2 ≤ i ≤ k), and then our goal is to find non-crossing traversals, or corresponding paths on the space-time graph. This can be done by fixing a path for A 1 , then using our algorithm from Section 2.1 to align a corresponding path for A 2 , then consider the path of A 2 as fixed, and align a path for A 3 and so on (recall that we can have an agent walk in infinite speed). The question of whether or not there exists an algorithm in 2D with running time fully polynomial in k remains open (for Fréchet distance of a set of curves, the best known running time is roughly O(n k ); see [DR04] ). For the continuous SDW in 2D and discrete SDW in 1D we give exact quadratic algorithms, conditional quadratic hardness, and approximation hardness. There are several versions of the problem for two agents that still remain open, notably the existence of a sub-quadratic time approximation algorithm with a factor slightly worse than what our lower bounds state, or of better hardness of approximation factors. Moreover, an intriguing and possibly useful extension of this definition is as follows. SDW of closed curves and polygons. Consider a scenario in which the polygonal curves R and B are closed curves. Here, the starting points of Red and Blue are not given as an input, and the goal is to decide whether they can traverse their respective curves while maintaining distance at least δ. The analogous Fréchet problem has been investigated by Alt and Godau [AG95] , who presented an O(n 2 log 2 n) time algorithm, and later by Schlesinger et. al. [SVY14] , who improved the running time to O(n 2 log n). Those algorithms include the construction of dynamic data structures for the free space diagram, which is again based on the fact that the free space within a cell is convex. Since, in our "flipped" case, the forbidden space is convex, similar data structures can be used in order to compute the SDW of two closed curves in near quadratic time. We can then define the Social Distance Width of two polygons P 1 , P 2 as a special case in which R is the boundary of P 1 and B is the boundary of P 2 ; i.e., SDW (P 1 , P 2 ) = SDW (∂P 1 , ∂P 2 ). Similarly, the Social Distance Width of a (single) polygon P is SDW (P ) = SDW (∂P, ∂P ). The notion of SDW of a polygon is possibly related to other characteristics of polygons, such as fatness. Intuitively, if the polygon P is fat under standard definitions, then the SDW of P will be large. However, the exact connection is yet unclear (see Figure 8) , and we leave open the question of what exactly is the relation between the two definitions. As (most) versions of the problem stated above has quadratic conditional lower bounds (which we blame on the Fréchet-like nature of SDW of two curve), we turn our attention to variants of the problem in which Blue has more freedom, and it can wander around in some given polygon domain. We present near-linear time algorithms for two such scenarios. In the first, Red is on a shortest path mission inside a polygon, where our algorithm strongly relays on the fact that Red's path is a geodesic. Red on an arbitrary path mission. For an arbitrary path R the problem can again be solved in nearly-quadratic time using the free-space diagram for Red on R and Blue on the boundary of P , since w.l.o.g. Blue is most separated from Red when Blue is on the boundary. We leave open the question of the existence of a sub-quadratic algorithm for this version of the problem. In the second scenario, Red is traversing the boundary of a skinny polygon, or an embedded tree. Computing the SDW of a tree can be stated as a special case of SDW among graphs. Social distance width of graphs. Analogous to our definition of SDW of two polygons, we can define the Social Distance Width of two graphs G 1 and G 2 as follows. Let R be a path that traverses all the edges of G 1 , and B a path in G 1 (not necessarily traversing the entire graph). Then SDW (G 1 , G 2 ) = max R,B SDW (R, B), i.e., the SDW of G 1 and G 2 is the maximum separation that can be achieved when Red is on a mission to traverse the entire graph G 1 , and Blue is restricted to move on G 2 and has to stay away from Red. Now, the Social Distance Width of a (single) graph G is SDW (G) = SDW (G, G) . In this case, Red and Blue are moving on the same graph G, and thus it is natural to consider the shortest path distance instead of Euclidean distance. Thus, in Section 3.2 we provided a linear time algorithm for computing SDW (T ) where T is a tree, under geodesic (shortest path) distance. This definition of SDW (G 1 , G 2 ) is analogous to the definition of Traversal Distance presented by Alt et al. [AERW03] , a generalization of Fréchet distance for graphs, where Red and Blue need to remain close to one another. Alt et al. showed a generalization of the free-space diagram for graphs, and obtained roughly quadratic time algorithm for computing the traversal distance between two graphs. As we showed in Section 2.2, a similar approach leads to roughly quadratic time algorithm for computing the SDW of two graphs. All our results on social distancing in graphs can be found in Appendix B. Finally, it would be interesting to find other relaxations or variants of the problem for which linear time algorithms exists. For example, allowing Blue to backtrack when traversing its polygonal curve (as in the weak Fréchet distance), arbitrary path mission in a simple polygon, or traversing other special types of graphs. Furthermore, we hope that this article will motivate a study into computing social distancing width in more general settings, for example, allowing different speed bounds, minimizing the makespan, and limiting the exposure time. The free space diagram. The δ-free space diagram [AG95] of two curves P and Q represents all possible traversals of P and Q with Fréchet distance at most δ. We adapt this notion to our new setting. Let C ij = [i, i + 1] × [j, j + 1] be a unit square in the plane, for integers 1 ≤ i ≤ n − 1 and 1 ≤ j ≤ m − 1. Let B = [1, n] × [1, m] be the square in the plane that is the union of the squares C ij . Given δ > 0, the δ-free space is F δ = {(p, q) ∈ B | P (p) − Q(q) ≥ δ}. In other words, it is the set of all red-blue positions for which the distance between the agents is at least δ. A point (p, q) ∈ F δ is a free point, and the set of non-free points (or forbidden points) is then B \ F δ . Note that for Fréchet distance, these definitions are reversed ("flipped"). We call the squares C ij the cells of the free space diagram; each cell may contain both free and forbidden points. An important property of the free space diagram is that the set of forbidden points inside a cell C ij (i.e., C ij ∩ F δ ) is convex [AG95] . δ C ij Figure 9 : Right: a free space cell C ij . For SDW, the free space is white, while for Fréchet distance, the free-space is gray. The gray region within a cell is convex. Left: the free space diagram of two curves. The black points and dashed lines indicate critical values of type (iii), which are openings in the free space diagram defined by two red edges and one blue edge. Notice that a monotone path through the free space F δ between two free points (p, q) and (p , q ) corresponds to a traversal of P [p, p ] and Q[q, q ]. Thus, SDW (P, Q) ≥ δ if and only if there exists a monotone path through the free space F δ between (0, 0) and (n, n) (i.e. (n, n) is "reachable" from (0, 0)). The Fréchet distance between P and Q can be computed in O(n 2 log n) time [AG95] as follows. For a given value of δ, the reachability diagram is defined to be the set of points in F δ reachable from (0, 0). As the set of free points in each cell is convex, the set of "reachable" points on each of the boundary edges of a cell is a line segment. Thus, one can construct in constant time the reachable boundary points of a cell, given the reachable boundary points of its bottom and left neighbor cells (see Figure 9 ). Therefore, computing the reachability diagram (and hence solving the decision version of the problem) takes O(n 2 ) time using a dynamic programming algorithm. For the optimization, there are O(n 3 ) critical values of δ, which are defined by (i) the distances between starting points and endpoints of the curves, (ii) the distances between vertices of one curve and edges of the other, and (iii) the common distance of two vertices of one curve to the intersection point of the bisector with some edge of the other. Then, parametric search, based on sorting, can be performed in time O((n 2 + T dec ) log n), where T dec is the running time for the decision algorithm. In the case of SDW , we can again compute the reachability diagram in O(n 2 ) time, as in each cell the set of forbidden points is convex, and thus the set of "reachable" points on each of the boundary edges of a cell is at most two line segments. The set of critical values is similar, except that the third type can occur between three edges (see Figure 9 , left). Thus, by arguments similar to [AG95] , we have a O(n 2 log n) time algorithm for computing SDW (P, Q). Theorem 6. There is an O(dn 2 log n) time exact algorithm for computing the SDW of two polygonal n-vertex curves in R d . For the discrete version of SDW , a simple dynamic programming algorithm (similar to the one known for discrete Fréchet distance) gives an O(n 2 ) solution. In short, let OP T [i, j] be the SDW of P [1, i] and Q[1, j]; then, by the definition of dSDW we have OP T Theorem 7. There exists an O(dn 2 ) time exact algorithm for computing the dSDW of two polygonal n-vertex curves in R d . In this section we consider social distancing measures for graphs. We focus on undirected graphs, but our results readily extend to directed graphs. A geometric graph is a connected graph with edges that are straight line segments embedded in the plane. We consider geometric graphs to be automatically weighted, with Euclidean edge weights. We will call non-geometric graphs simply as abstract graphs, and unless otherwise mentioned, we give each edge of an abstract graph a length of one. Since we are interested in formulating meaningful distance measures, we assume that an all-pairs shortest path preprocessing has been done on G, and pairwise distances are available in O(1) time. Let G = (V, E), n = |V| and m = |E|. By a path of length k in an abstract graph G = (V, E) we mean a sequence P of k vertices: P = {p 1 , p 2 , · · · , p k } ⊆ V, with edges p i p i+1 ∈ E for all 1 ≤ i ≤ k − 1, and we write |P | = k. Note that we allow vertices to be repeated (that is, we don't distinguish between a path and a walk). For abstract graphs, we assume that Red and Blue both move on the same graph, as there is no ambient metric defining the distance between Red and Blue. For geometric graphs, however, we will also consider the case when Red and Blue move on different graphs or in the embedding space, as the distance between them is still well-defined. We state our result for Blue staying away from Red on an abstract graph. Theorem 13 (Blue distancing from Red, abstract). Assume Red travels on a known path R of length k in an abstract graph G, and Blue can travel anywhere with a speed s ≥ 0 times that of Red, for some integer s. There exists a decision algorithm for the Blue distancing from Red-on-a-mission problem that • for s ∈ {0, 1, n − 1}, runs in time O(km), • for arbitrary 1 < s < n − 1, runs in time O(nk min(d s , n)), where d is the maximum degree of any vertex in G. Proof. Take k copies G i of G, for 1 ≤ i ≤ k; let (v, i) be the vertex corresponding to vertex v in the ith copy G i . Construct a directed graphG by connecting these copies as follows (it may be helpful to imagine these copies "stacked" on top of each other): • For every v ∈ V and every 1 ≤ i ≤ k − 1, add a directed edge from (v, i) to (v, i + 1). • If s = 0, add no more edges. If s = 1, add an edge between the vertex (v, i) and vertex (w, i + 1) for all neighbors w of v in G, for all (v, i), 1 ≤ i ≤ k − 1. • If 1 < s < n − 1, add an edge between between the vertex (v, i) and vertex (w, i + 1) for all vertices w such that the distance between w and v in G is at most s, for all (v, i), 1 ≤ i ≤ k − 1. Note that there are at most d s many such vertices, where d is the maximum degree of a vertex in G. • if s = n − 1, add an edge from vertex (v, i) to all vertices in G i+1 . Let R = {r 1 , r 2 , · · · , r k } be the path of Red. OnceG is constructed, delete the vertex (r i , i) and all its neighbors from G i if Blue is looking to stay distance at least one away from Red. If Blue instead aims to stay δ away, delete the δ neighborhood of these vertices from each copy. This results in a graph G . If Blue's starting position b is given, run BFS/DFS to see if b can reach any vertex in G k , and return yes or no accordingly. If blue can start from any vertex, then check if any vertex in G 1 can reach some vertex in G k , and answer yes or no accordingly. The runtime depends on the complexity ofG, which is O(mk) if s ∈ {0, 1, n − 1}, and O(nk min(d s , n)) otherwise, which completes the proof. Now we consider geometric graphs. Let R : [0, ] → R 2 be a polygonal curve in R 2 , consisting of line segments, with the ith line segment R i = R| [i−1,i] where 1 ≤ i ≤ . We also assume that each segment R i is parameterized naturally by R(i + λ) = (1 − λ)R(i) + λR(i + 1). The curve R is assumed to be known: this is how Red is traveling. On the other hand, we are also given a geometric graph G in which Blue is restricted to travel, and the problem is to determine if there is a path P ∈ G (a path in G is the polygonal curve formed by the edges between the start and end points of P ), such that SDW (R, P ) ≥ δ, where the SDW between R and P is defined as in the continuous SDW between polygonal curves in Section 2. Note that by adopting this definition we are considering the Euclidean distance between Red and Blue: if one instead considers geodesic distance, Red will also need to be restricted to travel in G. We remark on this setting later. Theorem 14 (Blue distancing from Red, geometric). The decision problem, given R (the path of Red) and G (the graph of Blue), and a distance δ, can be solved in time O(km), where k is the length of R (number of vertices) and m is the number of edges in G. Proof. We first define the free space surface for our problem. Consider an edge e i,j = (v i , v j ) ∈ E, and let F i,j δ denote the δ-free space of e i,j and R (note that e i,j : [0, 1] → R 2 is a polygonal curve of length 1). Analogous to [AERW03] , we glue the corresponding free-space diagrams of any two edges in E that share a common vertex, along the boundary of the diagram that corresponds to this vertex. Doing so for all edges e i,j ∈ E yields the free space surface S. As in [AERW03] , we get that there exists a path P in G with SDW (R, P ) ≥ δ if and only if there exists a y-monotone path through the δ-free space in S between a point (0, s) in some F i,j δ , to a point (k, t) in some F i ,j δ . Such a path corresponds to a continuous surjective traversal of R from R(0) to R(k), and some continuous non-surjective traversal P of G that Matching planar maps Computing the Fréchet distance between two polygonal curves Maximum thick paths in static and dynamic environments Approximation of geometric dispersion problems Approximability of the discrete Fréchet distance SETH says: Weak Fréchet distance is faster, but only if it is continuous and in one dimension Why walking the dog takes time: Fréchet distance has no strongly subquadratic algorithms unless SETH fails Approximating the (continuous) Search and pursuit-evasion in mobile robotics -A survey An improved approximation algorithm for the discrete Fréchet distance Geodesic Fréchet distance inside a simple polygon Coordinated motion planning: Reconfiguring a swarm of labeled robots with bounded stretch On the fréchet distance of a set of curves Computing discrete Fréchet distance Generalized selection and ranking: Sorted matrices Maximum dispersion and geometric maximum weight cliques Optimal shortest path queries in a simple polygon Algorithms for rapidly dispersing robot swarms in unknown environments Hybrid motion planning: Coordinating two discs moving among polygonal obstacles in the plane Computing the geodesic center of a simple polygon Similarity of closed polygonal curves in Fréchet metric By similar arguments, such a path can be found in O(km) time by computing the reachability diagram as in g(t)), where h is a traversal of H and g is a partial traversal of G. The setting is that Red is going about its business on H, and must traverse it completely in some order, while Blue is only trying to stay away, and is restricted to be on G. Finally, we define for a graph G Theorem 15. For two geometric graphs H and G, the Euclidean SDW (H, G) can be computed in time O(m h m g ), where m h (resp. m g ) denotes the number of edges in the graph H (resp. G) It is enough to show how to compute SDW To this end, we construct the free space surface in a manner similar to that of the Red-on-a-mission case described previously. For every edge e = (u, v) ∈ H and f = (x, y) ∈ G, we construct a free space cell C e,f , which can be thought of as a subset of [0, 1] 2 . For edges e and e sharing a vertex v, we glue C e,f and C e ,f along their right and left edges, respectively, which correspond to C v,f . In this way we obtain a cell complex in three dimensions The above result shows that when d denotes the Euclidean distance For any L > 0, the free space (defined to be the points for which the geodesic distance is at least L) inside a cell of the free-space diagram is a convex polygon Then, the geodesic distance between a point at position x on e and a point at position y on f is simply d(x, y) = min(x + d 2 + y, x + d 1 + |f | − y, |e| − x + d 4 + y, |e| − x + d 3 + |f | − y), which is a minimum of four functions that are linear in (x, y). Thus, d(x, y) is concave, piecewise-linear, and the locus of points (x, y) for which d(x, y) ≥ L is a convex polygon We thank the many participants of the Stony Brook CG Group, where discussions about geometric social distancing problems originated in Spring 2020, as the COVID-19 crisis expanded worldwide. We would also like to thank Gaurish Telang for helping to solve a system of non-linear equations. In this section we describe algorithms for computing continuous and discrete SDW (R, B); the algorithms are based on similar algorithms for computing the continuous and discrete Fréchet distances, in times O(n 2 log n) and O(n 2 ), respectively. As with Fréchet distance, our algorithms use the notion of a free-space diagram, appropriately adapted.