Finding a shortest route is not easy for a watchman patrolling streets

Imagine you were a watchman, having to patrol some streets. Today you were assigned to straight, well-illuminated, and wide streets, that can be checked with a glance from the intersection.

Credit: Paul-W
Credit: Paul-W

Before starting the route, you want to determine the shortest route allowing to check all your streets. How difficult can this be?

Dumitrescu et al.1 study the complexity of this watchman route problem, for which a more formal statement needs a couple of easy definitions: First, a set of lines is said to be connected if, for any pair of points on them, it is possible to travel between the two points moving along the given lines. This turns out to be equivalent to not all the lines being parallel (which is most likely the case for streets).

Second, a watchman route in a set of lines is a closed polygonal path along them, such that every point on the given lines is visible from at least one point of the path. Note that the path has to be closed, i.e., the initial and the final points must be the same (so that the watchman goes back to the headquarters).

Now one can formally state:

The Watchman Route problem for Lines (WRL):

Given a connected set of lines, find a shortest watchman route.

Analogously, replacing lines by segments in the two definitions above, one can also consider:

The Watchman Route problem for Segments (WRS):

Given a connected set of segments, find a shortest watchman route.

credit: Dimitriescu et al (2014)
Credit: Dimitriescu et al (2014)

Although these problems remind to the well-known Traveling Salesman Problem, Dumitrescu et al. prove that the Watchman Route problem for Lines (WRL) in 2D can actually be solved in polynomial time O(n^8), also for the variant in which only a subset of the given lines needs to be visited and you are allowed to move along the whole set of given lines. Their proof is via solving a related Minimum Convex Hull problem, for which dynamic programming is used.

On the contrary, the authors prove that the Watchman Route problem for Segments (WRS) in 2D is NP-hard, even for axis-aligned segments. Their proof adapts that from Dumitrescu and Tóth 2 for the NP-hardness of computing a shortest watchman route in a polygon with holes.

Furthermore, Dumitrescu et al. prove that the 3D version of the Watchman Route problem is also NP-hard, both for lines (WRL) and segments (WRS), even in the case of orthogonal lines or segments. Indeed, their proof relates these problems to the Geometric Traveling Salesman Problem 34, which is known to be NP-hard for both the orthogonal and the euclidean metrics 5.

Finally, Dumitrescu et al. show that the randomized approximation algorithm by Fakcharoenphol et al. 6 yields an approximation ratio O(\log^3 n) for the Watchman Route problem for segments (WRS) in any dimension. For the 2D case, a deterministic algorithm with a better approximation ratio O(\log^2 n) has been later proposed by Mitchell 7.

In addition, the authors consider some special cases of the Watchman Route problem for Segments (WRS), for which they are able to provide an improved approximation or an exact algorithm. The first one is the case in which the segments do not intersect too much, meaning that there are at most c intersection points on each segment. Then, there is a polynomial-time algorithm for the WRS with an approximation factor of 3c/2.

The second special case is that of outerplanar grids, an arrangement of axis-aligned segments such that every segment has a point on the (boundary of) the outer face of the arrangement. In this case, they show that the WRS can be solved in O(n \log n) time.

Credit: Dimitriescu et al (2014)
Credit: Dimitriescu et al (2014)

As a coda, let me bring here two of the interesting open problems suggested in the paper:

  • Can the O(n^8) running time of the algorithm for the Watchman Route problem for Lines (WRL) in 2D be improved?

  • What is the complexity of the watchman route problem for planes in 3D?


  1. Dumitrescu A., Mitchell J.S.B. & Żyliński P. (2014). Watchman routes for lines and line segments, Computational Geometry, 47 (4) 527-538. DOI: 10.1016/j.comgeo.2013.11.008
  2. Adrian Dumitrescu, Csaba D. Tóth. Watchman tours for polygons with holes. Computational Geometry: Theory and Applications 45:7 (2012) 326-333.
  3. Michael R. Garey, David S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness, W.H. Freeman and Company, New York, 1979.
  4. Christos H. Papadimitriou. The Euclidean Travelling Salesman Problem is NP-Complete. Theoretical Computer Science 4 (1977) 237-244.
  5. Michael R. Garey, Ronald L. Graham, and David S. Johnson, Some NP-complete geometric problems. In: Proceedings of the 8th ACM Symposium on Theory of Computing, 1976, 10–22.
  6. J. Fakcharoenphol, S. Rao, K. Talwar. A tight bound on approximating arbitrary metrics by tree metrics. Journal of Computer and System Sciences 69 (3) (2004) 485–497.
  7. Joseph S.B. Mitchell. Approximating watchman routes. In: Proceedings of the 24th Annual ACM–SIAM Symposium on Discrete Algorithms, 2013, 844–855.

Written by

Leave a Reply

Your email address will not be published.Required fields are marked *