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 entryexit flow as much as possible (“flow” version), or to increase the length of the shortest entryexit 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 superbarrier. 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 superbarriers (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 nofly 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 checkin desk or controlling the flow of spectators to an event entrance.
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., flowhBD 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 lineartime 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 superbarrier; 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 flowHBD and pathHBD, i.e., blocking with multiple differentlength barriers in polygons with (a large number of) holes. We also prove weak hardness of the versions with small number of holes (flowhBD and pathhBD). Finally, we argue that path blocking is weakly hard if the barriers have the same length (pathHB1). Section 5 presents polynomialtime algorithms for path blocking with few barriers (pathHbD), implying that pathhbD, pathHb1 and pathhb1 are also polynomial. The section then describes polynomialtime algorithms for the remaining versions of flow blocking. We first show that the problem is pseudopolynomial if the barriers have the same length (flowHB1). We then prove that blocking with few barriers (flowHbD) is strongly polynomial, implying that flowhbD, flowHb1 and flowhb1 are also polynomial. Finally, we show polynomiality of the version with constant number of holes (flowhB1). Table 1 summarizes the hardness and polynomiality of our results.
HBD  HB1  HbD  Hb1  hBD  hB1  hbD  hb1  

Path  NPhard  weakly NPhard  poly  poly  weakly NPhard  ?  poly  poly 
Flow  NPhard  pseudopoly  poly  poly  weakly NPhard  poly  poly  poly 
2 Preliminaries
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 divergencefree (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 [11] 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 [22], and the maximum value of the  flow is equal to the capacity of the minimum cut [29]; moreover, the mincut is defined by the shortest  path in the critical graph [20].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).^{1}^{1}1Other 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 [24]. Also a more generic view, outside our scope, could be to combine the flow and path problems into considering minimumcost 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 .
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) [21]. 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 Lineartime 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 lineartime 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 superbarrier.
3.1 A most vital barrier is “rooted” at a vertex of
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 (equallength) 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.
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 halfplanes. 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 samedirection 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.∎
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 to 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).
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 [7], and use it to compute [15]. 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 [6]. ∎
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 to 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 . ∎
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 nonempty 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 halfplane 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).
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 constantsize 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 [19]. Computing and also requires linear time [13]. 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 superbarrier. This implies that our lineartime algorithm from the previous section can still be used to solve the problem.
Clearly, any solution distributes the barriers over some (unknown) number of superbarriers. First observe that, similarly to Section 3.1, any superbarrier must have a vertex at a vertex of , and the next lemmas prove that it is suboptimal to have more than one such superbarrier.
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 .
Lemma 19.
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,
By triangle inequality,
Thus,
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 straightline segment. By simple vector manipulation we can show that , and thus,
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
and
By the triangle inequality we have that , and thus
Lemma 20.
Given two barriers, possibly of different lengths, an optimal configuration will stack them into a single superbarrier.
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.
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
and
Applying Lemma 19 we get that
Then, summing up these inequalities we get
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
It also must hold that
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 unitlength barriers, the optimal placement of the barriers which maximizes the length of the shortest path between and consists of a single superbarrier.
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 superbarrier. 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 superbarrier of length . ∎
Theorem 21 implies that placing an arbitrary set of barriers reduces to placing just one superbarrier, so our lineartime 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 [20].
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.
FlowHBD and pathHBD are NPhard.
Proof.
Figure 12 shows the reduction for flowHBD (for pathHBD, just replace the edges with the points ,): given an instance of 3Partition (“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 3Partition instance is feasible. ∎
With differentlength barriers, the full blockage remains (weakly) hard even if (and the number of holes is, of course, also small):
Theorem 23.
FlowhBD and pathhBD are weakly NPhard.
Proof.
Given an instance of 2Partition (“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 2Partition 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 flowHB1 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.
PathHB1 is weakly NPhard.
Proof.
Given an instance of 2Partition, 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.
Our red (top) and blue (bottom) routes are completely symmetric, so we describe only the top route. For each opening in the middle corridor, we build a vertical segment with bottom endpoint . In between every consecutive pair we build three long vertical walls attached to the middle corridor, and three long vertical walls attached to the top boundary of that force the red route to zigzag (see Fig. 13). Let , , and be the topendpoints of the walls connected to the middle corridor. The distances between these walls (and the walls extending from the top of ) are all large, i.e., larger than , so that we cannot block the passage even if we place all barriers consecutively. The walls extending from the top of are built so that the length of the shortest path between and via , i.e. our zigzag, is very large, say . Let be the distance from via to . We place (and the endpoints of the walls extending from the top) such that the distance from via to is .
Making sure that we use barriers to block the middle route.
Note that for the shortest  path to have length at least , it needs to pass through at least zigzags from our red or blue routes. Hence, we need to block the middle route between any pair of consecutive openings and . Since we have exactly barriers, we have to place one barrier, say barrier , to close off the middle corridor between and .
Next, observe that if we place barrier to block off the middle corridor between and at some coordinate other than , we can just shift it to without decreasing the length of the shortest path. Furthermore note that connecting the left endpoint of the bottom gap to the right endpoint of the top gap allows either the top or the bottom path to bypass one of the long “spikes” of length , hence such a placement is nonoptimal.
Claim: Any shortest path either stays entirely above middle route or entirely below it.
We now argue that there are only two potential shortest paths left: one that stays entirely above the middle corridor, and one that stays below it. Suppose that a shortest path goes through the zigzag on the red route, i.e., above the corridor, and thus passes through , and then crosses the middle route to . Since we place barrier at , this path has to go around the horizontal segment . It follows that the length of this path is at least , where