 # Most vital segment barriers

We study continuous analogues of "vitality" for discrete network flows/paths, and consider problems related to placing segment barriers that have highest impact on a flow/path in a polygonal domain. This extends the graph-theoretic notion of "most vital arcs" for flows/paths to geometric environments. We give hardness results and efficient algorithms for various versions of the problem, (almost) completely separating hard and polynomially-solvable cases.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

This paper addresses the following kind of questions:

Given a polygonal domain with an “entry” and an “exit”, where should one place a given set of “barriers” so as to decrease the maximum entry-exit flow as much as possible (“flow” version), or to increase the length of the shortest entry-exit path as much as possible (“path” version)?

Figure 1 illustrates these questions in their simplest form (placing a single barrier in a simple polygon). We call the solutions to the problems most vital segment barriers for the flow and the path resp. The name derives from the notion of most vital arcs in a network – those whose deletion decreases the flow or increases the length of the shortest path as much as possible. While the graph problems are well studied [1, 2, 4, 5, 16, 18, 23, 27], to our knowledge, geometric versions of locating “most vital” facilities have not been explored. Throughout the paper, the segment barriers will be called simply barriers. When several segments are aligned to form a longer barrier, we call this longer segment a super-barrier. We focus only on segment barriers because already with segments there are a number of interesting problem versions, and in principle, any polygonal barrier may be created from sufficiently many segments; however, our results imply that the optimal blocking is always attained by gluing the barriers into super-barriers (no other configuration of segments is most vital).

Determining the most vital barriers is related to resilience and critical infrastructure protection, as it identifies the most vulnerable spots (“bottlenecks, weakest links”) in the environment by quantifying how fragile or robust the flow/path is, how much it can be hurt, in the worst case, due to an adversarial act. It is thus an example of optimizing from an adversarial point of view: do as much harm as possible using available budget. In practice, the abstract “bad” and “good” may swap places, e.g., when the “good guys” build a defense wall, under constrained resources, to make the “evil” (epidemics, enemy, predator, flood) reach a treasure as late as possible (for the path version) or in a small amount (for the flow version). Our problem may also be viewed as a Stackelberg game (in networks/graphs parlance aka interdiction problems [9, 12, 14, 28, 30], extensively studied due to its relation to security) where the leader places the blockers and the follower computes the maximum flow or the shortest path around them.

Our paper also contributes to the plethora of work on uncertain environments [8, 17, 25]. Motion planning under uncertainty is important, e.g., in computing aircraft paths: locations of hazardous storm systems and other no-fly zones are not known precisely in advance, and it is of interest to understand how much the path or the whole traffic flow may be hurt, in the worst case, if new obstacles pop up (of course, there are many other ways to model weather uncertainty).

Finally, similar types of problems arise when barriers are installed for managing the queue to an airline check-in desk or controlling the flow of spectators to an event entrance. Figure 1: A polygon in which a single barrier is placed to minimize the flow between two edges of the polygon (left) or lengthen the shortest path between two points (right).

#### Taxonomy.

Since our input consists of the domain and the barriers, several problem versions may be defined:

H/h

The domain may have an arbitrary number of holes (such versions will be denoted by H) or a constant number of holes (denoted by h)

B/b

There may be arbitrarily many barriers (denoted B) or barriers in the input (denoted b)

D/1

The barriers may have different lengths (denoted D) or all have the same unit length

Overall, for each of the two problems—flow blocking and path blocking—we have 8 versions (HBD, HB1, HbD, Hb1, hBD, hB1, hbD, hb1); e.g., flow-hBD is the problem of blocking the flow in a polygonal domain with holes using arbitrarily many barriers of different lengths, etc. We allow barriers to intersect the holes. Depending on the nature of the barriers and the environment, in some of the envisioned applications these may be impractical (e.g., if a hole is pillar in the building, a barrier cannot run through it) while in others the assumptions are natural (e.g., if a hole is a pond near the entrance to an event). From the theoretical point of view, in most of our problems these assumptions are w.l.o.g. because in the optimal solution the barriers just touch the holes, not “wasting” their length inside a hole (one exception is HBD in which the solution may change if the barriers must avoid the holes).

#### Overview of the results.

Section 3 describes our main technical contribution: a linear-time algorithm for the fundamental problem of finding one most vital barrier for the shortest - path in a simple polygon. The algorithm is based on observing that the barrier must be “rooted” at a vertex of the polygon. The main challenge is thus to trace the locations of the barrier’s “free” endpoint (the one not touching the polygon boundary) through the overlay of shortest path maps from and . The overlay has quadratic complexity, so instead of building it, we show that only a linear number of the maps’ cells can be intersected and work out an efficient way to go through all the cells. Furthermore, we prove that when placing multiple barriers they can be lined up into a single super-barrier; this reduces the problem to that of placing one barrier. In the remainder of the paper we consider polygons with holes. Section 4 shows hardness of the most general problems flow-HBD and path-HBD, i.e., blocking with multiple different-length barriers in polygons with (a large number of) holes. We also prove weak hardness of the versions with small number of holes (flow-hBD and path-hBD). Finally, we argue that path blocking is weakly hard if the barriers have the same length (path-HB1). Section 5 presents polynomial-time algorithms for path blocking with few barriers (path-HbD), implying that path-hbD, path-Hb1 and path-hb1 are also polynomial. The section then describes polynomial-time algorithms for the remaining versions of flow blocking. We first show that the problem is pseudopolynomial if the barriers have the same length (flow-HB1). We then prove that blocking with few barriers (flow-HbD) is strongly polynomial, implying that flow-hbD, flow-Hb1 and flow-hb1 are also polynomial. Finally, we show polynomiality of the version with constant number of holes (flow-hB1). Table 1 summarizes the hardness and polynomiality of our results.

## 2 Preliminaries Figure 2: Flow setup. An S-T flow decomposed into 3 thick paths (yellow); two edges of the critical graph, defining a cut (dashed).

Let be a polygonal domain with vertices, and let the source and the sink be two given edges on the outer boundary of (Fig. 2). A flow in

is a vector field

with the following properties: (there are no source/sinks inside the domain), where is the unit normal to the boundary of at point (the flow enters/exits only through the source/sink), and (the permeability of any point is 1, i.e., not more than a unit of flow can be pushed through any point – the flow respects the capacity constraint). Similarly to the discrete network flow, the value of a continuous flow is the total flow coming in from the source () – since in the interior of the flow is divergence-free (flow conserves inside ), by the divergence theorem, the value is equal to the total flow out of the sink (). A cut is a partition of into 2 parts with in different parts (analogous to a cut in a network); the capacity of the cut is the length of the boundary between the parts. Finally, the source and the sink split the outer boundary of into two parts called the bottom and the top , and the critical graph of the domain  is the complete graph on the domain’s holes, and , whose edge lengths equal to the distances between their endpoints (we assume that the edges are embedded to connect the closest points on the corresponding holes, or ). The celebrated Flow Decomposition and MaxFlow/MinCut theorems for network flows have continuous counterparts: (the support of) a flow decomposes into (thick) paths , and the maximum value of the - flow is equal to the capacity of the minimum cut ; moreover, the mincut is defined by the shortest - path in the critical graph .

For shortest path blocking, the setup is a bit more elaborated. Let be a point on the outer boundary of , and let be the edge containing . We assume that is actually an infinitesimally small gap in the boundary of (with below and above), and that the union of the barriers and the holes is not allowed to contain a path that starts on below and ends on above , completely cutting out (Fig. 3).111Other modeling choices could have been made; e.g, another way to avoid complete blockage could be to introduce a “protected zone” around à la in works on geographic mincut . Also a more generic view, outside our scope, could be to combine the flow and path problems into considering minimum-cost flows [22, 10] (the shortest path is the mincost flow of value 0) and explore how the barriers could influence both the capacity of the domain and the cost of the flow. W.l.o.g. we treat and as vertices of . Similarly, we are given a point , modeled as a gap in another edge on the outer boundary of . Figure 3: Path setup; barriers are red and s-t path is blue. Surrounding s−s+ (left) is forbidden, even if no barrier touches the gap. Completely “shutting the door” s−s+ with one barrier (right (a)) is not allowed: if a barrier is at s, it must touch at most one of s−,s+ (right (b,c)).

Let denote a shortest path (a geodesic) between points and in . Where it creates no confusion, we will identify a path with its length; in particular, for two points , we will use to denote both the segment and its length. The shortest path map from , denoted , is the decomposition of into cells such that shortest paths from to all points within a cell visit the same sequence of vertices of ; the last vertex in this sequence is called the root of the cell and is denoted by . The shortest path map from () and the roots of its cells () are defined analogously. The maps have linear complexity and can be built in time (in time if is simple) . Our algorithm for path blocking in a simple polygon uses:

###### Lemma 1.

[26, Lemma 1] Let , , and be three points in a simple polygon . The geodesic distance from to a point is a convex function of .

Finally, let denote the ellipse with foci and , going through the point . It is well known that the sum of distances to the foci is constant along the ellipse; for the points outside (resp. inside) the ellipse, the sum is larger (resp. smaller) than . It is also well known that the tangent to the ellipse at is perpendicular to the bisector of the angle (the light from reaches after reflecting from the ellipse at ).

## 3 Linear-time algorithms for simple polygons

In this section is a simple polygon. For a set , let denote the shortest path between points in (and the length of the path), i.e., the shortest path avoiding . We first consider finding the most vital unit barrier for the shortest path, i.e., finding the unit segment maximizing . For the path blocking, we (re)define the bottom and top of as the and parts of resp. (which mimics the flow setup, replacing the entrance and exit with and ). We will treat , and as vertices of . We then prove that a most vital barrier is placed at a vertex of (Section 3.1). We focus on placing the barrier at (a vertex of) ; placing at is symmetric. In Section 3.2 we test whether it is possible for any unit barrier touching to also touch (while not lying on or ): if this is possible, the barrier separates from completely and . We test this by computing the Minkowski sum of with a unit disk and intersecting the resulting shape with , taking special care around and (to disallow having ). In Section 3.3 we then proceed to our main technical contribution: showing how to optimally place a barrier touching (a vertex of) given that no such barrier can simultaneously touch . For this, we compute the shortest - path around the Minkowski sum of with the unit disk and argue that an optimal barrier will have one endpoint on (a vertex of) and the other endpoint on . Furthermore, we show that this path intersects edges of the shortest path maps and only linearly many times. We subdivide at these intersection points, and show that for each edge of we can then calculate the optimal placement of a point on maximizing the sum of distances to and . This gives us a linear-time algorithm for finding a single most vital barrier. In Section 3.4 we then show that even if we have multiple barriers, it is best to glue the barriers together into a single super-barrier.

### 3.1 A most vital barrier is “rooted” at a vertex of P

We first make some observations about potentially optimal placements.

###### Lemma 2.

A most vital barrier touches .

###### Proof.

Suppose that a most vital barrier does not touch . Clearly, there must be two (equal-length) shortest - paths, and , going through and resp., for otherwise the shortest path length can be increased by shifting along its supporting line. We argue that there is always a direction in which can be translated so that the lengths of both and increase. Figure 4: Red dots are rs(a) and rt(a). Left: It is always possible to translate ab so that a moves into τ+ and b moves into σ+. The tangent will not change when rt(a) jumps from v to u. Right: Sliding b to the right lengthens πa

Consider the ellipse through ; let be the tangent to at , and let be the (closed) halfplane that does not contain (Fig. 4, left). In order to increase , the barrier should be moved so that moves into . Similarly, let be the closed halfplane, moving into which increases (the halfplane is defined by the tangent , at , to the ellipse ). There is a direction so that the rays in direction starting in and , respectively, are contained in the corresponding half-planes. Hence, we can translate in this direction so that both and increase. Thus, if none of the roots , , , changes as the barrier is translated, the length of both and increases.

It remains to deal with the case in which one of the four roots would change during the infinitesimal translation (say, changes from a vertex to a vertex ) – i.e., when belongs to the line . Let be the tangents at to resp. (refer to Fig. 4, left). Can it be the case that the directions inside and do not have a common direction, i.e., that the good translations defined by (the ones increasing ) are incompatible with those defined by (so that would be stuck with on the line because the path length would increase both when moving from the cell of into the cell of and vice versa)? The answer is no, because : the former is perpendicular to the bisector of the angle and the latter is perpendicular to the bisector of the angle – which are the same angle.∎

###### Lemma 3.

A vertex of a most vital barrier touches .

###### Proof.

Suppose that none of touches the boundary (so touches with a point interior to the barrier). Clearly, the shortest - path, , must go through both and , for otherwise the shortest path can be lengthened by moving the barrier; also, must make same-direction turns (cw or ccw) at both and , for otherwise the shortest - path may bypass the barrier altogether (Fig. 5, left and middle). We claim that it is always possible to move along its supporting line (i.e., keeping the contact with ) increasing the length of . Indeed, if one of the angles is obtuse and the other is acute (Fig. 5, right), then moving in the direction of the acute angle increases both and (we assume that the path visits before ). If both angles are acute, then, as can be easily seen by differentiation, the derivative of the path length w.r.t. the shift of along its supporting line is unless the angles are equal; however, if the angles are equal, the length is at the minimum (which, again, can be seen by differentiation). The case of both angles being obtuse is similar.∎ Figure 5: The path is blue, red dots are rs(a) and rt(b). Left: If the path bends only on b, moving ab up lengthens πb. Middle: If the turns are different, πab is not pulled taut. Right: Moving ab left lengthens πab
###### Lemma 4.

There exists a most vital barrier in which one endpoint, say , lies on a vertex of .

###### Proof.

Suppose that the barrier touches the interior of an edge of (Fig. 4, right). Then the shortest - path through may be lengthened by translating the barrier parallel to itself while sliding along the edge—the argument is analogous to the one in the proof of Lemma 2: one of the two possible translation directions moves inside the halfplane . ∎

### 3.2 Blocking the path from s to t completely

We now argue that we can check in linear time whether it is possible to completely block passage from to , by placing a barrier that connects to (without placing the barrier along or , which is forbidden by our model; see Section 2).

###### Observation 5.

Let and be two vertices of in . The geodesic makes a right turn at if and only if it makes a right turn at . Let and be two vertices of in . The geodesic makes a left turn at if and only if it makes a left turn at . Moreover, if makes a right turn in then it makes a left turn in .

Assume without loss of generality that makes a right turn at a vertex . By Observation 5 it thus makes right turns at all vertices of , and left turns at all vertices of .

###### Observation 6.

If makes a right turn at , and we place a barrier at , then makes a right turn at .

For every point on , consider placing a barrier of length at most one, with one endpoint on . The possible placements of the other endpoint, , form a subset of the unit disk centered at . Let denote the union of all these regions (see Fig. 6). Figure 6: Our algorithm constructs the region D describing possible placements of a barrier incident to B, and the shortest path H around D. An optimal barrier incident to B has one endpoint on H.
###### Observation 7.

There is a barrier that separates from if and only if and are in different components of .

We now observe that is essentially the Minkowski sum of with a unit disk . More specifically, let denote the Minkowski sum of and , let denote the part of in , let , , and be defined analogously, and let .

###### Lemma 8.

We have that , where , , and is the unit disk centered at the origin. Moreover, can be computed in time.

###### Proof.

The equality follows directly from the definition of and the Minkowski sum. It then also follows has linear complexity. So we focus on computing . To this end we separately compute , , and , and take their union. More specifically, we construct the Voronoi diagram of using the algorithm of Chin, Snoeyink, and Wang , and use it to compute  . Both of these steps can be done in linear time. Since , , and have constant complexity, we can compute and in constant time. The resulting sets still have constant complexity, so unioning them with takes linear time. ∎

###### Lemma 9.

We can test if and lie in the same component of , and compute if it exists, in time.

###### Proof.

Using Lemma 8 we compute in linear time. If or lies inside , which we can test in linear time, then does not exist. Otherwise, by definition of and , and must lie on the boundary of . We then extract the curve connecting to along the boundary of , and test if intersects the top of the polygon . If (and only if) and do not intersect, their concatenation delineates a single component of . Since contains both and we have . So, all that is left is to test if and intersect. This can be done in linear time by explicitly constructing and testing if it is simple . ∎

###### Theorem 10.

Given a simple polygon with vertices and two points and on the boundary of , we can test whether there exists a placement of a unit length barrier that disconnects from in time.

### 3.3 Maximizing the length from s to t with a single barrier

In the remainder of the section we assume that we cannot place a barrier on (a vertex of) that completely separates from . Fix a distance , and consider all points such that . Let denote this set of points, and define .

Observe that an optimal barrier will have one of its endpoints on the boundary of . Let be the shortest path from to avoiding . We will actually show that there is an optimal barrier whose endpoint lies on , and that has low complexity. This then gives us an efficient algorithm to compute an optimal barrier. To show that lies on we use that if realizes detour (i.e., ), the endpoint also lies on . First, we prove some properties of towards this end.

###### Observation 11.

Let be a cell in with root , and be a cell in with root . We have that consists of a constant number of intervals along the boundary of the ellipse with foci and .

###### Proof.

A point satisfies . For we thus have . Since , , and are constant, this equation describes an ellipse with foci and . Since and have constant complexity the lemma follows. ∎

###### Lemma 12.

is a geodesically convex set (it contains shortest paths between its points).

###### Proof.

Let and be two points on , and assume, by contradiction, that there is a point on outside of . By Lemma 1 the geodesic distance from to is a convex function. Similarly, the distance from to is convex. It then follows that the function , for on is also convex, and thus has its local maxima at and/or . Contradiction. ∎

###### Lemma 13.

If there is an optimal barrier incident to a vertex of , then the ray from through intersects .

###### Proof.

The ray splits into two subpolygons and . Since makes a right bend at (Observation 6 and our assumption that makes a right turn at ) it intersects both subpolygons and . It is easy to show that therefore and must be in different subpolygons (otherwise the geodesic crosses a second time, and we could shortcut the path along ). Since connects to it must thus also intersect . ∎ Figure 7: A sketch of the regions C≤d (purple) and Rd. Observe that Rd cannot contain any vertices of T, otherwise T would have to pierce SP(s,t) and thus C≤d.

Next, we define the region “below” . More formally, let be the region enclosed by and , let , and let . See Fig. 7. We then argue that it is separated from the top part of our polygon , which allows us to prove that there is an optimal barrier with an endpoint on .

###### Observation 14.

Region contains no vertices of .

###### Proof.

Assume, by contradiction that there is a vertex of in . Observe that this disconnects . However, since is geodesically convex (Lemma 12) and non-empty it is a connected set. Contradiction. ∎

###### Lemma 15.

If there is an optimal barrier where is a vertex of , then there is an optimal barrier where is a point on (recall that is the unit disk centered at ).

###### Proof.

Assume, by contradiction, that there is no optimal barrier incident to that has its other endpoint on . Consider the ray from in the direction of . By Lemma 13, the ray hits in a point (Fig. 8). Because lies on and is geodesically convex (Lemma 12), lies outside . Let be the maximal (open ended) subpath of that contains and lies outside of . We then distinguish two cases, depending on whether or not intersects (touches) :

does not intersect (touch) .

It follows that is a geodesic in as well, i.e. . Since , and is geodesically convex (Lemma 12) we then have that . Contradiction.

intersects in a point .

Let be a point such that . We distinguish two subcases, depending on whether lies in the region .

.

In this case lies “below” . From it follows that . However, as is geodesically convex, this must mean that has a vertex in at which it makes a left turn. This implies that is a vertex of . By Observation 14 there are no vertices of in . Contradiction.

Observe that is a valid candidate barrier. Since , the point actually lies above (i.e. to the left of) , and thus makes a right turn at . Using that it follows that . This contradicts that is the maximal detour we can achieve.

Since all cases end in a contradiction this concludes the proof. ∎

We now know there exists an optimal barrier with an endpoint on . Next, we focus on the complexity of .

###### Observation 16.

Let and be two points on , such that makes a left turn in between and (i.e. the subcurve of between and intersects the half-plane right of the supporting line of ). Then contains a vertex of .

###### Lemma 17.

The curve intersects an edge of , with , at most twice. Hence, intersects at most times.

###### Proof.

If is a polygon edge, then cannot intersect at all, so consider the case when is interior to . Assume, by contradiction, that intersects at least three times, in points , , and , in that order along (Fig. 9). Figure 9: The two cases in the proof of Lemma 17.

If the intersections , , and , are also consecutive along , then makes both a left and right turn in between and . It is easy to see that since can bend to the left only at vertices of (Observation 16), the region (or one of the two regions) enclosed by and must contain a polygon vertex. Since both and lie inside , this means that has a hole. Contradiction.

If the intersections are not consecutive, (say ), then again there is a region enclosed by and , containing a polygon vertex. Since both and lie inside , this vertex must lie on a hole. Contradiction. ∎

#### Algorithm.

We compute intersections of with the shortest path maps and , and subdivide at each intersection point. By Lemma 17, the resulting curve still has only linear complexity. Consider the edges of in which follows the boundary of , for the vertices of . By Lemma 15 for some there is an optimal barrier that has one endpoint on such an edge of and the other at . Since has only edges we simply try each edge of . For all points , the geodesics and have the same combinatorial structure, i.e., the roots stay the same. It follows that we have a constant-size subproblem in which we can compute an optimal barrier in constant time. Specifically, we compute the smallest ellipse with foci and that contains and goes through the point in which and have a common tangent (if such a point exists). See Fig. 6. For that point , we then also know the length of the shortest path , assuming that we place the barrier . We then report the point that maximizes this length over all edges of .

Constructing the connected component of that contains and takes linear time (Lemma 9). This component is a simple splinegon, in which we can compute the shortest path connecting to in time . Computing and also requires linear time . We can then walk along , keeping track of the cells of and containing the current point on . Computing the ellipse, the point on the current edge , and the length of the geodesic takes constant time. It follows that we can compute an optimal barrier incident to in linear time. We use the same procedure to compute an optimal barrier incident to . We thus obtain the following result.

###### Theorem 18.

Given a simple polygon with vertices and two points and on , we can compute a unit length barrier that maximizes the length of the shortest path between and in time.

### 3.4 Using multiple vital barriers

We prove a structural property that even when we are given many barriers, there always exists an optimal solution in which they glued into a single super-barrier. This implies that our linear-time algorithm from the previous section can still be used to solve the problem.

Clearly, any solution distributes the barriers over some (unknown) number of super-barriers. First observe that, similarly to Section 3.1, any super-barrier must have a vertex at a vertex of , and the next lemmas prove that it is suboptimal to have more than one such super-barrier.

The first lemma is a variant of Lemma 1. Let and be two segments inside , and let be two points that divide the segments in the same proportion, that is for some . Define function .

is convex for :

###### Proof.

Consider two cases: when the paths intersect and when they do not.

Case 1. Paths and intersect (Fig. 10, left). Choose some intersection point . From Lemma 1 it follows that a shortest path from a fixed point to a point on a given segment is a convex function. Then,

 SP(c,m1)≤γSP(c,a1)+(1−γ)SP(c,b1) and SP(c,m2)≤γSP(c,a2)+(1−γ)SP(c,b2).

By triangle inequality,

 SP(m1,m2)≤SP(c,m1)+SP(c,m2).

Thus,

 SP(m1,m2)≤γSP(a1,a2)+(1−γ)SP(b1,b2). Figure 10: From left to right: Cases 1, 2a, 2b from Lemma 19.

Case 2. Paths and do not intersect.

Case 2a. Suppose the path is also disjoint from the paths and (Fig. 10, middle). Because is a simple polygon, the path must be a straight-line segment. By simple vector manipulation we can show that , and thus,

 SP(m1,m2)=m1m2≤γa1a2+(1−γ)b1b2≤γSP(a1,a2)+(1−γ)SP(b1,b2).

Case 2b. Finally, w.l.o.g., assume that the path intersects , but not (Fig. 10, right). Let vertex of lie on both paths and . Because is a simple polygon, there exists a point visible to . Let divide the segment in the same proportion, i.e., . We can apply the same line of reasoning to the segments and , and the segments and . Either the case 2a will hold, or we have arrived at the same case 2b but a smaller size instance. Thus, recursively we can show that

 SP(m1,m′)≤γSP(a1,a′)+(1−γ)SP(b1,b′),

and

 SP(m′,m2)≤γSP(a′,a2)+(1−γ)SP(b′,b2).

By the triangle inequality we have that , and thus

 SP(m1,m2)≤γSP(a1,a2)+(1−γ)SP(b1,b2).\qed
###### Lemma 20.

Given two barriers, possibly of different lengths, an optimal configuration will stack them into a single super-barrier.

###### Proof.

First note that if the two barriers intersect, their endpoints must coincide. To see this, treat one of the barriers as (a part of) a hole; then, by Lemmas 25 and 26 (which are proved in Section 5 analogously to Lemmas 2 and 3) and Lemma 4, the barriers must touch each other with their vertices. It is easy to see that at the point of the touching, the barriers must form a angle. In what follows we will assume that the barriers are disjoint.

Let the two barriers be the segments where are vertices of , and let be their lengths. Let point lie on the extension of segment into with (i.e., extend for distance ); similarly, let lie on the extension of with (Fig. 11). If (or ) intersects the polygon boundary, then either and get disconnected, or the shortest path from to cannot pass through (or resp.). In both cases, the original configuration of the barriers was not optimal. Figure 11: Illustration to Lemma 20. The potential barriers are red.

Then, assume that and are interior to . W.l.o.g. assume that lies between and on the shortest path from to . For simplicity assume that the path passes through point , and that the path passes through point (Fig. 11, left and middle). Later we will lift this assumption.

Applying Lemma 1 we get that

 SP(s,m1)≤αα+βSP(s,a)+βα+βSP(s,p),

and

 SP(m2,t)≤βα+βSP(b,t)+αα+βSP(q,t).

Applying Lemma 19 we get that

 SP(m1,m2)≤αα+βSP(a,q)+βα+βSP(p,b).

Then, summing up these inequalities we get

 SPpm1,qm2(s,t)=SP(s,m1)+SP(m1,m2)+SP(m2,t)≤αα+β(SP(s,a)+SP(a,q)+SP(q,t))+βα+β(SP(s,p)+SP(p,b)+SP(b,t))=αα+βSPpa(s,t)+βα+βSPpb(s,t).

Thus, either or (or both).

Now assume that path intersects segment in point , and path intersects in point (Fig. 11, right). Then, let points and be the points dividing the segments and in the proportion and respectively. Applying the same argument as above, we get that

 SPpm1,qm2(s,t)≤αα+βSPpa(s,t)+βα+βSPpb(s,t).

It also must hold that

 SPpm′1,qm′2(s,t)≥SPpm1,qm2(s,t).

We can again conclude that at least one of the following inequalities hold, or . That is, the original configuration of the two blocking barriers is not optimal. ∎

Lemma 20 resolves the question for two barriers that are attached to the boundary of . We use induction to extend the result to an arbitrary number of barriers.

###### Theorem 21.

Given a simple polygon with vertices, two points and on , and unit-length barriers, the optimal placement of the barriers which maximizes the length of the shortest path between and consists of a single super-barrier.

###### Proof.

We use induction on . The base case for follows from Lemma 20.

First, we argue that Lemma 2 generalizes to arbitrary rigid configurations of barriers: as we translate the configuration, the length of the shortest path above (below) the configuration is a convex differentiable function in the translation vector, and hence there must still be at least one direction in which the configuration can be translated so as to increase the lengths of both paths. Thus, we may assume that the optimal configuration of the barriers touches .

But now, consider (one of) the barrier that touches , and consider it to be part of . By the induction hypothesis, the remaining barriers are combined into a single super-barrier. But then, the optimal solution for barriers must be the same as the optimal solution to a problem in which we have only two barriers: one of length and one of length . We apply Lemma 20 again and conclude that the optimal solution uses, in fact, a single super-barrier of length . ∎

Theorem 21 implies that placing an arbitrary set of barriers reduces to placing just one super-barrier, so our linear-time algorithm from the previous section applies.

### 3.5 Most vital barriers for the flow

In simple polygons the critical graph has only two vertices – and (which, for the flow blocking, are the and parts of ; refer to Fig. 2). Flow blocking thus boils down to finding the shortest - connection (then all the barriers will be placed along the connecting segment) – a problem that was solved in linear time in .

## 4 Hardness results

In the remainder of the paper is a polygonal domain with holes (as defined in Section 2). We first show that in general it is hard to decide whether full blockage can be achieved, i.e., whether it is possible to decrease the - flow to 0 or to lengthen the - path to infinity:

###### Theorem 22.

Flow-HBD and path-HBD are NP-hard.

###### Proof. Figure 12: Full blockage is possible iff each channel is fully blocked

Figure 12 shows the reduction for flow-HBD (for path-HBD, just replace the edges with the points ,): given an instance of 3-Partition (“Can given integers be split into triples so that the sum of integers in each triple is equal to ?”), construct the domain with width- channels between and , and have a length- barrier (line segment) for each integer ; the barriers can cut from iff the 3-Partition instance is feasible. ∎

With different-length barriers, the full blockage remains (weakly) hard even if (and the number of holes is, of course, also small):

###### Theorem 23.

Flow-hBD and path-hBD are weakly NP-hard.

###### Proof.

Given an instance of 2-Partition (“Can given integers be split into two sets so that the sum of integers in set is equal to ?”), construct the domain with width- channels between and (analogously to the proof of Theorem 22), and have a length- barrier for each integer ; the barriers can cut from iff the 2-Partition instance is feasible. ∎

If all barriers have the same length, deciding possibility of full blockage is polynomial; in fact, Section 5.1 shows that even the more general flow-HB1 problem (finding how to maximally decrease the flow) can be solved in polynomial time. On the contrary, (partial) path blockage is hard even for unit barriers:

###### Theorem 24.

Path-HB1 is weakly NP-hard.

###### Proof.

Given an instance of 2-Partition, we construct a domain with vertices, in which it is possible to place unit barriers so that the shortest - path has length (where is some number and is the sum of numbers in a set ), iff can be partitioned into two sets and with .

Our construction is sketched in Fig. 13. The main idea is that there are three main routes from to : a very short middle route, a “red” (top) route, and a “blue” (bottom) route. The red and blue routes both have length , for some large constants and , and are much longer than the middle route. We make it such that with exactly barriers, we can block off the middle route completely. Moreover, by placing a barrier appropriately, we can increase the length of either the red route or the blue route by exactly . Increasing the length of the red route by corresponds to assigning to and increasing the length of the blue route by corresponds to assigning to . So, in the end the length of the red and blue routes are and , respectively. Hence, it is possible to partition into and , with if and only if the length of the shortest path between and is at least .

#### Description of the Construction.

In detail, the outer boundary of is a large rectangle, centered vertically at the -axis and at the origin.

Our middle route will consist of a rectangular corridor of height vertically centered at the -axis. We cut through the top and bottom walls of the corridor in intervals , for some arbitrarily small . Let and be the points with -coordinate on the top and bottom wall, respectively. See Fig. 14. We build another horizontal segment of length whose right endpoint is . Note that we have vertices with exactly the same -coordinate; also note that in order for the construction to work, we must allow placing the barrier so that it contains vertices of the domain.