Untangling circular drawings: Algorithms and complexity

Sujoy Bhore, Guangping Li, Martin Nöllenburg, Ignaz Rutter, Hsiang-Yun Wu · DOI

Abstract

We consider the problem of untangling a given (non-planar) straight-line circular drawing $\delta_G$ of an outerplanar graph $G=(V, E)$ into a planar straight-line circular drawing by shifting a minimum number of vertices to a new position on the circle. For an outerplanar graph $G$, it is clear that such a crossing-free circular drawing always exists and we define the circular shifting number shift$(\delta_G)$ as the minimum number of vertices that are required to be shifted in order to resolve all crossings of $\delta_G$. We show that the problem Circular Untangling, asking whether shift$(\delta_G) \le K$ for a given integer $K$, is NP-complete. For $n$-vertex outerplanar graphs, we obtain a tight upper bound of shift$(\delta_G) \le n - \lfloor\sqrt{n-2}\rfloor -2$. Based on these results we study Circular Untangling for almost-planar circular drawings, in which a single edge is involved in all the crossings. In this case, we provide a tight upper bound shift$(\delta_G) \le \lfloor \frac{n}{2} \rfloor-1$ and present a constructive polynomial-time algorithm to compute the circular shifting number of almost-planar drawings.

Introduction: The Circular Untangling Problem

Circular drawings are a popular method for visualizing graphs, where vertices are placed on the perimeter of a circle and edges are represented as straight lines. For outerplanar graphs, a planar circular drawing—one without any edge crossings—is always theoretically possible. However, in practice, initial drawings often contain numerous crossings that obscure the graph's structure.

The "untangling" problem asks: what is the minimum number of vertices we must move to new positions on the circle to eliminate all crossings? This metric, known as the circular shifting number, is vital for maintaining visual stability in dynamic visualizations, as it seeks to preserve the user's mental map by minimizing changes.

Figure 1: A basic example of untangling: (a) a tangled drawing and (b) its planar circular equivalent.

Complexity and Theoretical Bounds

The general problem of finding the circular shifting number is computationally difficult. The authors prove that Circular Untangling is NP-complete. This proof involves a reduction from the 3-Partition problem, mediated by a new intermediate problem called "Distinct Increasing Chunk Ordering with Reversals." This highlights that the difficulty lies in managing the relative order and orientation of different graph components (cycles) to maximize the number of fixed vertices.

Despite this hardness, the paper establishes tight mathematical bounds for $n$-vertex outerplanar graphs. Using the Erdős-Szekeres Theorem—which guarantees long monotonic subsequences in permutations—they show that the number of moves required is at most $n - \lfloor\sqrt{n-2}\rfloor - 2$. This bound is proven to be tight, meaning there are specific graph configurations that actually require this many moves.

Efficient Solutions for Almost-Planar Drawings

While the general problem is hard, many real-world "messy" drawings are nearly planar. The authors focus on almost-planar drawings, where all crossings are caused by a single problematic edge.

For these cases, the problem becomes significantly easier. The authors provide a tighter upper bound, showing that no more than $\lfloor n/2 \rfloor - 1$ vertices need to be moved. More importantly, they present a constructive $O(n^2)$ time algorithm to find the absolute minimum number of shifts required to fix such a drawing. This algorithm leverages graph connectivity analysis to determine which side of the problematic edge is best to "unwrap."

Figure 2: Untangling a more complex 10-vertex graph. The algorithm identifies the optimal set of vertices to shift to restore planarity.

Conclusion and Future Directions

This research provides a comprehensive look at the complexity of cleaning up circular graph drawings. By proving NP-completeness for the general case and providing efficient algorithms for almost-planar ones, the authors map out the boundaries of what is computationally feasible.

Future work may explore parameterized complexity—seeing if the problem becomes easier when the number of crossings is small—or investigate different untangling operations, such as swapping adjacent vertices or rotating entire sub-graphs. These insights are essential for developing more robust and user-friendly graph visualization tools.

Summary updated

BibTeX
@inproceedings{bhore2021untangling,
  author = {Sujoy Bhore and Guangping Li and Martin Nöllenburg and Ignaz Rutter and Hsiang-Yun Wu},
  title = {{Untangling circular drawings: Algorithms and complexity}},
  booktitle = {Comput. Geom},
  year = {2021},
  doi = {10.4230/lipics.isaac.2021.19},
}
Figure