SPIRALITY AND OPTIMAL ORTHOGONAL DRAWINGS GIUSEPPE DI BATTISTA , GIUSEPPE LIOTTA , AND FRANCESCO VARGIU § SIAM J. COMPUT. c 1998 Society for Industrial and Applied Mathematics Vol. 27, No. 6, pp. 1764–1811, December 1998 012 Abstract. We deal with the problem of constructing the orthogonal drawing of a graph with the minimum number of bends along the edges. The problem has been recently shown to be NP- complete in the general case. In this paper we introduce and study the new concept of spirality, which is a measure of how an orthogonal drawing is “rolled up,” and develop a theory on the interplay between spirality and number of bends of orthogonal drawings. We exploit this theory to present polynomial time algorithms for two significant classes of graphs: series-parallel graphs and 3-planar graphs. Series-parallel graphs arise in a variety of problems such as scheduling, electrical networks, data-flow analysis, database logic programs, and circuit layout. Also, they play a central role in planarity problems. Furthermore, drawings of 3-planar graphs are a classical field of investigation. Key words. graph drawing, orthogonal representation, planar embedding, bend minimization AMS subject classifications. 05C85, 90B10, 90C27 PII. S0097539794262847 1. Introduction. A graph drawing algorithm receives as input a graph and pro- duces as output a drawing that nicely represents such a graph; several references on the subject of graph drawing can be found in [23, 7]. Most graph drawing algorithms can be roughly split into the following two main steps. 1. A planar embedding of the given graph is found by a planarization algorithm, possibly by inserting dummy vertices for crossings. The planar embedding is usually described by the cyclic ordering of the edges incident at each vertex. Planarization algorithms are implemented by using variations of the classical planarity testing algorithms (see, e.g., [12]). 2. Once a planar embedding has been found, a representation algorithm is ap- plied to produce the final drawing. Such an algorithm is selected depending on the requirements of the application and on the graphic standard. It can be targeted to minimize the global area of the drawing, to have as few bends as possible along the edges, to emphasize symmetries, etc. The representation algorithm produces a drawing within the planar embedding computed by the planarization algorithm. However, the choice of the planar embed- ding can deeply affect the results obtained by the representation algorithm. In Fig. 1 we show two different planar embeddings of the same graph. Besides each planar embedding we show the orthogonal drawing (edges are mapped to polygonal chains of horizontal and vertical segments) with the minimum number of bends that can be * Received by the editors February 4, 1994; accepted for publication (in revised form) October 15, 1996; published electronically June 3, 1998. This research was partially supported by CNR under grant CTB 94.00023.07, by NATO-CNR Advanced Fellowship Programme, the National Science Foundation under grant CCR-9423847, the EC ESPRIT Long Term Research Project ALCOM-IT under contract 20244, and the U.S. Army Research Office under grant DAAH04–96–1–0013. http://www.siam.org/journals/sicomp/27-6/26284.html Dipartimento di Informatica e Automazione, Universit` a di Roma Tre, via della Vasca Navale 84, I-00146 Roma, Italia (dibattista@iasi.rm.cnr.it). Dipartimento di Informatica e Sistemistica, Universit` a di Roma “La Sapienza,” via Salaria 113, I-00198 Roma, Italia (liotta@dis.uniroma1.it). Part of this research was done while the author was with the Center of Geometric Computing at the Department of Computer Science, Brown University. § Autorit` a per l’Informatica nella Pubblica Amministrazione, piazzale Kennedy 20, I-00144 Roma, Italia (vargiu@aipa.it). 1764