#
More Compact Orthogonal Drawings by Allowing Additional Bends ^{†}

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

**fl**exible

**ed**ge compaction problem with

**fi**xed

**ve**rtex star geometry, henceforth the Fled-Five compaction problem, which asks for the minimization of the vertical (horizontal, respectively) edge length and allows changing the orthogonal shape of edges, but preserves the x-monotonicity (y-monotonicity, respectively) of edge segments and prohibits changing the directions of the initial edge segments around the vertices (vertex star geometry). We present a polynomial-time algorithm based on a network flow model that solves the Fled-Five compaction problem to optimality. Our computational results show that repeated application of Fled-Five compaction in x- and y-direction is able to reduce the total edge length and the drawing area at the expense of additional bends. We also experimented with approaches to control the number of additional bends.

## 2. State-of-the-Art

## 3. Notation and Preliminary Results

#### 3.1. Orthogonal Graph Drawing

#### 3.2. Compaction of Orthogonal Drawings

**Lemma**

**1.**

**Proof.**

## 4. The Fled-Five Compaction Approach

**fl**exible

**ed**ge compaction problem with

**fi**xed

**ve**rtex star geometry (Fled-Five compaction problem). For vertical compaction it is defined as follows: Given a planar grid drawing $\mathsf{\Gamma}$ of a 4-graph G with an orthogonal representation ${H}_{\mathsf{\Gamma}}$, compute another planar grid drawing of G that minimizes the vertical edge length subject to fixed x-coordinates in which all horizontal edge segments of $\mathsf{\Gamma}$ are drawn x-monotonically and the vertex star geometry for all vertices as well as the planar embedding is maintained.

#### 4.1. The Fled-Five Compaction Algorithm

**Observation**

**1.**

Algorithm 1: verticalAugmentation |

Algorithm 2: verticalNetworkConstruction |

Algorithm 3: verticalLengthAssignment |

Algorithm 4: verticalFledFive |

Input: orthogonal drawing $\mathsf{\Gamma}$Output: optimal solution ${\mathsf{\Gamma}}^{\prime}$ to the Fled-Five compaction problem $\widehat{\mathsf{\Gamma}}$ ← normalize($\mathsf{\Gamma}$); $\tilde{\mathsf{\Gamma}}$ ← verticalAugmentation($\widehat{\mathsf{\Gamma}}$); N ← verticalNetworkConstruction($\tilde{\mathsf{\Gamma}}$); x ← computeMinimumCostFlow(N); ${\mathsf{\Gamma}}^{\prime}$ ← verticalLengthAssignment($\tilde{\mathsf{\Gamma}}$, x); ${\mathsf{\Gamma}}^{\prime}$ ← RemoveVisibilityEdges(${\mathsf{\Gamma}}^{\prime}$); ${\mathsf{\Gamma}}^{\prime}$ ← RemoveBendVertices(${\mathsf{\Gamma}}^{\prime}$); |

**Theorem**

**1.**

**Proof.**

#### 4.2. Remarks on the Running Time

**Corollary**

**1.**

#### 4.3. Controlling the Number of New Bends

#### 4.4. Extensions to Other Models

## 5. Experimental Evaluation

`FF`focusing on the total edge length and area improvement. Klau et al. [14] compared 12 compaction heuristics that maintain the orthogonal representation and we chose the best of these traditional heuristics (t2fl in [14]), which we call

`TRAD`, for comparison in order to demonstrate the benefit of slightly changing the orthogonal shape. In [14], this method was within one percent of the optimal value for practical instances. We do not compare against an optimal algorithm, e.g., the method of Klau and Mutzel [9], since the IP could not cope with most of our instances in a reasonable time. We refrain from comparing to improvement algorithms such as the 4M algorithm [15] or the refinement method from [16] since they change the vertex star geometry, the topology and even vertex sizes. The moving operation of the 4M algorithm is the only operation that fits our model, but would not change any layout generated by a flow-based compaction algorithm. The only applicable modification from [16] (superfluous bends) does not have an impact on bend minimal drawings that we use as input.

`TRAD`, we apply a constructive compaction method, that transforms the orthogonal representation into a turn-regular one and then runs a flow-based coordinate assignment in order to get a feasible planar grid drawing. Then, we repeatedly apply horizontal and vertical compaction steps with a flow-based improvement method until no further improvement can be achieved, see heuristic t2fl in [14]. For

`FF`, we use the same constructive method and then apply the modified flow technique from Section 4 with a cost of one for the network arcs causing double bends to achieve best possible shortening, also repeatedly in horizontal and vertical direction. Recall that, although both approaches are optimal for the one-dimensional compaction problems, repeated application of horizontal and vertical compaction steps does in general not lead to drawings with optimal total edge length for the two-dimensional compaction problems. Notice also that, due to the alternating repetitions in

`FF`, the monotonicity of edge segments may no longer be maintained.

#### 5.1. General Performance

`FF`compared to those of

`TRAD`:

**Hypothesis**

**1.**

**Hypothesis**

**2.**

**Hypothesis**

**3.**

BICON | In total, 240 biconnected planar 4-graphs with 40–500 vertices, randomly generated with modified methods from OGDF. Starting with a triangle the graph is expanded by splitting edges or faces, maintaining 4-planarity. |

QUASI | So-called quasi-trees which are known to be hard to compact optimally. They have already been used in the compaction literature (e.g., [14,30]). The set consists of 565 graphs with 40–2500 vertices. |

ROME | The well-known Rome graphs introduced in [4] consists of about 11,000 real-world and real-world like graphs with 10–100 vertices. These graphs are widely used as benchmarks in various graph drawing experiments. |

ROME4P | 4-planarized Rome graphs, i.e., we initially turned all Rome graphs into planar 4-graphs by planarizing them with methods from OGDF and replacing vertices with $k>4$ outgoing edges with faces of size k. This results in a graph size of up to 374 vertices. |

IMDB | A movie collaboration data set of 1000 ego-networks of actors/actresses with 10–72 vertices [31]. |

IMDB4P | A set of 4-planarized graphs of IMDB. Because the input graphs are very dense, we get graphs with over 10,000 vertices. Due to the very high running time for instances of this size, we selected a subset of 936 graphs that have at most 2500 vertices each. |

`QUASI`,

`ROME`and

`IMDB`, we followed the Giotto model, see Section 4.4. The graphs are internally also 4-planarized before the orthogonalization step and therefore we have their expanded versions as input for the compaction phase.

**(H1)**Figure 7 shows the average decrease of the total and maximum edge length as well as of the area in percent. In all graph classes, the total edge length as well as the area has decreased. We were able to decrease the total edge length by up to 39.3% and the area by up to 66.6% (over all instances). In general, larger graphs allow a larger reduction. For five instances the total edge length and for 13 instances the area increased, which may be due to decisions of

`FF`in early iterations that blocked further improvements in later iterations. It turned out that for the majority of the instances we were also able to reduce the maximum edge length. However, in general, the results are mixed, reaching from a shortening by 72.6% to more than tripling the length. Subfigures (a–c) in Figure 9, Figure 10, Figure 11 and Figure 12 show absolute values for the total edge length, the area and the maximum edge length measured for four of the six tested graph classes. The plots for

`ROME4P`and

`IMDB4P`are omitted, since they are very similar to those for

`ROME`and

`IMDB`.

**(H2)**Figure 8 displays the average increase of the number of bends. If an instance had no bends after

`TRAD`, we use the number of bends after

`FF`as relative increase to take also these instances into account for computing the average increase of bends. As expected, the drawings produced by

`FF`have many more bends, especially for the Rome graphs. In one of the worst cases, the number of bends increased from 1 to 60. Although the relative increase of bends is very high, the average number of bends per edge in the drawings produced by

`FF`ranges between 0 and 0.75 in comparison to at most 0.46 for drawings produced by

`TRAD`. Recall that we have started with bend minimal orthogonal representations. Subfigure (d) in Figure 9, Figure 10, Figure 11 and Figure 12 show the absolute values for the number of bends measured for the test graphs. Figure 13 plots the relation between the number of bends and the number of edges for

`ROME`and

`QUASI`. The other graph classes show a similar behaviour.

**(H3)**We have measured the total running time and the number of performed compaction iterations. For better comparison, we also display the running time divided by the number of iterations, because

`FF`tends to do more iterations. The reason is that a compaction step of

`FF`changes the drawing and therefore the flow network of the next step more significantly, leading to more new possibilities for compaction. Figure 8 displays the average increase of the running time and the number of visibility edges. In all cases, the number of additional dissecting edges has increased significantly. In general, the running time per iteration for

`FF`is very close to that for

`TRAD`, but the running time per iteration has sometimes decreased, more often for small graphs. For

`ROME`and

`ROME4P`it even has gone down for clearly most of the instances. This effect can be explained by the fact that

`TRAD`and

`FF`have the same input only for the first iteration. They change the drawing in different ways resulting in different networks for the minimum cost flow problem in later iterations. Now, although the networks are bigger for

`FF`, the network simplex algorithm may find an optimal solution faster here than in a smaller network. The highest decrease of the time per iteration was 62.1%. However, it also increased by 112.3% in the worst case. If we look at the total running time, we observe a clearer increase, but the times are still of roughly the same order of magnitude. Subfigures (e), (f) in Figure 9, Figure 10, Figure 11 and Figure 12 display the measured running time per iteration and the total running time, respectively.

#### 5.2. Reducing the Number of Additional Bends

`FF`. Figure 14 gives the relation between the number of invested bends and the improvement in terms of area and total edge length for

`BICON`and

`IMDB4P`. For some instances, the growth of the number of bends is very high. Therefore, we tried three different ways for controlling the number of additional bends and examined the impact on the resulting total edge length and area improvement. As a test set, we used the subset of the Rome graphs with 50–150 vertices (6294 graphs). These instances showed the greatest increase regarding the number of bends.

#### 5.3. Increasing the Cost for New Bends

`TRAD`decreases with increasing arc costs, see Figure 15a. With a slightly higher arc cost, we can reduce the number of additional bends without drastically affecting the area and total edge length improvement. The average relative increase of bends went down from 435.7% for an arc cost of one to 202.1% for an arc cost of two and 143.3% for an arc cost of three. The average improvement of area (total edge length) is 19.5% (10.7%), 17.1% (8.5%) and 15.0% (7.4%), respectively. The differences between higher arc costs in terms of additional bends become smaller. The data regarding the number of bends scatter over a wide range (notice the different scale on the right in Figure 15 for the change of bends).

#### 5.4. Increasing the Minimum Length of an Edge to Get Bends

#### 5.5. Decreasing the Ratio of Number of Bends To Edge Length

## 6. Conclusions

## Author Contributions

## Funding

## Acknowledgments

## Conflicts of Interest

## References

- Batini, C.; Nardelli, E.; Tamassia, R. A layout algorithm for data flow diagrams. IEEE Trans. Softw. Eng.
**1986**, SE-12, 538–546. [Google Scholar] [CrossRef] - Tamassia, R. On Embedding a Graph in the Grid with the Minimum Number of Bends. SIAM J. Comput.
**1987**, 16, 421–444. [Google Scholar] [CrossRef] - Patrignani, M. On the Complexity of Orthogonal Compaction. In Algorithms and Data Structures, 6th International Workshop, WADS ’99; Springer: Berlin, Germany, 1999; Volume 1663, pp. 56–61. [Google Scholar] [CrossRef]
- Di Battista, G.; Garg, A.; Liotta, G.; Tamassia, R.; Tassinari, E.; Vargiu, F. An Experimental Comparison of Four Graph Drawing Algorithms. Comput. Geom.
**1997**, 7, 303–325. [Google Scholar] [CrossRef] - Lengauer, T. Combinatorial Algorithms for Integrated Circuit Layout; John Wiley & Sons, Inc.: New York, NY, USA, 1990. [Google Scholar]
- Bannister, M.J.; Eppstein, D.; Simons, J.A. Inapproximability of Orthogonal Compaction. J. Graph Algorithms Appl.
**2012**, 16, 651–673. [Google Scholar] [CrossRef][Green Version] - Di Battista, G.; Eades, P.; Tamassia, R.; Tollis, I.G. Graph Drawing: Algorithms for the Visualization of Graphs; Prentice-Hall: Upper Saddle River, NJ, USA, 1999. [Google Scholar]
- Bridgeman, S.S.; Di Battista, G.; Didimo, W.; Liotta, G.; Tamassia, R.; Vismara, L. Turn-regularity and optimal area drawings of orthogonal representations. Comput. Geom.
**2000**, 16, 53–93. [Google Scholar] [CrossRef] - Klau, G.W.; Mutzel, P. Optimal Compaction of Orthogonal Grid Drawings. In International Conference on Integer Programming and Combinatorial Optimization; Cornuéjols, G., Burkard, R.E., Woeginger, G.J., Eds.; Springer: Berlin, Germany, 1999; Volume 1610, pp. 304–319. [Google Scholar] [CrossRef]
- Kaufmann, M.; Wagner, D. (Eds.) Drawing Graphs, Methods and Models; Springer: Berlin, Germany, 2001; Volume 2025. [Google Scholar]
- Dai, W.; Kuh, E. Global spacing of building-block layout. In Proceedings of the IFIP TC 10/WG 10.5 International Conference on Very Large Scale Integration, Vancouver, BC, Canada, 10–12 August 1987; pp. 193–205. [Google Scholar]
- Eiglsperger, M.; Kaufmann, M. Fast Compaction for Orthogonal Drawings with Vertices of Prescribed Size. In Proceedings of the Graph Drawing, 9th International Symposium, GD 2001, Vienna, Austria, 23–26 September 2001; Revised Papers. pp. 124–138. [Google Scholar] [CrossRef]
- Hashemi, S.M.; Tahmasbi, M. A better heuristic for area-compaction of orthogonal representations. Appl. Math. Comput.
**2006**, 172, 1054–1066. [Google Scholar] [CrossRef] - Klau, G.W.; Klein, K.; Mutzel, P. An Experimental Comparison of Orthogonal Compaction Algorithms. In International Symposium on Graph Drawing; Marks, J., Ed.; Springer: Berlin, Germany, 2001; Volume 1984, pp. 37–51. [Google Scholar] [CrossRef]
- Fößmeier, U.; Heß, C.; Kaufmann, M. On Improving Orthogonal Drawings: The 4M-Algorithm. In International Symposium on Graph Drawing; Whitesides, S., Ed.; Springer: Berlin, Germany, 1998; Volume 1547, pp. 125–137. [Google Scholar] [CrossRef]
- Six, J.M.; Kakoulis, K.G.; Tollis, I.G. Refinement of Orthogonal Graph Drawings. In International Symposium on Graph Drawing; Whitesides, S., Ed.; Springer: Berlin, Germany, 1998; Volume 1547, pp. 302–315. [Google Scholar] [CrossRef]
- Spönemann, M.; Fuhrmann, H.; von Hanxleden, R.; Mutzel, P. Port Constraints in Hierarchical Layout of Data Flow Diagrams. In International Symposium on Graph Drawing; Eppstein, D., Gansner, E.R., Eds.; Revised Papers; Springer: Berlin, Germany, 2010; Volume 5849, pp. 135–146. [Google Scholar] [CrossRef]
- De Mendonça Neta, B.M.; Araújo, G.H.D.; Guimarães, F.G.; Mesquita, R.C.; Ekel, P.Y. A fuzzy genetic algorithm for automatic orthogonal graph drawing. Appl. Soft Comput.
**2012**, 12, 1379–1389. [Google Scholar] [CrossRef] - Freivalds, K.; Glagolevs, J. Graph Compact Orthogonal Layout Algorithm. In Proceedings of the Combinatorial Optimization—Third International Symposium, ISCO 2014, Lisbon, Portugal, 5–7 March 2014; Revised Selected Papers. pp. 255–266. [Google Scholar] [CrossRef]
- Tamassia, R. (Ed.) Handbook on Graph Drawing and Visualization; Chapman and Hall/CRC: Boca Raton, FL, USA, 2013. [Google Scholar]
- Ahuja, R.K.; Magnanti, T.L.; Orlin, J.B. Network Flows: Theory, Algorithms, and Applications; Prentice-Hall, Inc.: Upper Saddle River, NJ, USA, 1993. [Google Scholar]
- Király, Z.; Kovács, P. Efficient implementations of minimum-cost flow algorithms. Acta Univ. Sapientiae Inform.
**2012**, 4, 67–118. [Google Scholar] - Cornelsen, S.; Karrenbauer, A. Accelerated Bend Minimization. J. Graph Algorithms Appl.
**2012**, 16, 635–650. [Google Scholar] [CrossRef][Green Version] - Orlin, J.B. A Faster Strongly Polynominal Minimum Cost Flow Algorithm. In Proceedings of the 20th Annual ACM Symposium on Theory of Computing, Chicago, IL, USA, 2–4 May 1988; pp. 377–387. [Google Scholar] [CrossRef]
- Holzhauser, M.; Krumke, S.O.; Thielen, C. Budget-constrained minimum cost flows. J. Comb. Optim.
**2016**, 31, 1720–1745. [Google Scholar] [CrossRef] - Fößmeier, U.; Kaufmann, M. Drawing High Degree Graphs with Low Bend Numbers. In International Symposium on Graph Drawing; Brandenburg, F., Ed.; Springer: Berlin, Germany, 1995; Volume 1027, pp. 254–266. [Google Scholar] [CrossRef]
- Tamassia, R.; Di Battista, G.; Batini, C. Automatic graph drawing and readability of diagrams. IEEE Trans. Syst. Man Cybern.
**1988**, 18, 61–79. [Google Scholar] [CrossRef] - Jünger, M.; Klau, G.W.; Mutzel, P.; Weiskircher, R. AGD—A Library of Algorithms for Graph Drawing. In Graph Drawing Software; Springer: Berlin, Germany, 2004; pp. 149–172. [Google Scholar] [CrossRef]
- Chimani, M.; Gutwenger, C.; Jünger, M.; Klau, G.W.; Klein, K.; Mutzel, P. The Open Graph Drawing Framework (OGDF). In Handbook of Graph Drawing and Visualization; Tamassia, R., Ed.; CRC Press: Boca Raton, FL, USA, 2013; Chapter 17; pp. 543–569. [Google Scholar]
- Klau, G.W. A Combinatorial Approach to Orthogonal Placement Problems. Ph.D. Thesis, Saarland University, Saarbrücken, Germany, 2002. [Google Scholar] [CrossRef]
- Yanardag, P.; Vishwanathan, S.V.N. Deep Graph Kernels. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, Sydney, Australia, 10–13 August 2015; pp. 1365–1374. [Google Scholar] [CrossRef]

**Figure 1.**(

**a**) A drawing with large areas of white space due to shape restrictions; and (

**b**) introducing two additional bends to red edge of the drawing leads to a smaller drawing.

**Figure 2.**The flow networks: (

**a**) ${N}_{y}$ for vertical compaction; and (

**b**) ${N}_{x}$ for horizontal compaction. White vertices are dummy vertices and dashed edges are dummy edges. Coloured network arcs over dashed graph edges have no cost, while all other arcs have a cost of one. All network arcs have a lower bound of one.

**Figure 3.**Modifications in Fled-Five: (

**a**) the original edge of length three; (

**b**) modification allowed in Fled-Five; (

**c**) not allowed because of changed x-coordinates; and (

**d**) not allowed because x-monotonicity is violated.

**Figure 4.**A graph and the arcs of the corresponding flow network: (

**a**,

**b**) of the traditional algorithm; and (

**c**) in our algorithm. Arc labels in (

**a**,

**b**) describe flow on network arcs, unlabeled arcs carry one unit of flow. Panel (

**c**) demonstrates the network structure, no flow is indicated.

**Figure 5.**Input graph with modified flow network and a minimum cost flow (all unlabeled arcs carry one unit of flow) with the resulting drawing: (

**a**) without additional dissecting edges; and (

**b**) including additional dissecting edges. The bold edge in (

**a**) indicates an edge overlap and the grey vertices result from normalization, the white vertices in (

**b**) are bend vertices. Dissecting edges are indicated in (

**b**).

**Figure 6.**${K}_{5}$ subdivision in the modified network. Solid network nodes are the nodes of ${K}_{5}$, empty network nodes correspond to subdivided edges.

**Figure 7.**Average change of the total edge length, the maximum edge length and the area from

`TRAD`to

`FF`in percent for: (

**a**)

`BICON`; (

**b**)

`QUASI`; (

**c**)

`ROME`; (

**d**)

`ROME4P`; (

**e**)

`IMDB`; and (

**f**)

`IMDB4P`.

**Figure 8.**Average change of the number of bends, the time per iteration, the total running time and the number of visibility edges from

`TRAD`to

`FF`in percent for: (

**a**)

`BICON`; (

**b**)

`QUASI`; (

**c**)

`ROME`; (

**d**)

`ROME4P`; (

**e**)

`IMDB`; and (

**f**)

`IMDB4P`.

**Figure 9.**Absolute results of

`TRAD`and

`FF`for

`BICON`: (

**a**) total edge length; (

**b**) area; (

**c**) maximum edge length; (

**d**) number of bends; (

**e**) time per iteration; and (

**f**) total running time.

**Figure 10.**Absolute results of

`TRAD`and

`FF`for

`QUASI`: (

**a**) total edge length; (

**b**) area; (

**c**) maximum edge length; (

**d**) number of bends; (

**e**) time per iteration; and (

**f**) total running time.

**Figure 11.**Absolute results of

`TRAD`and

`FF`for

`ROME`: (

**a**) total edge length; (

**b**) area; (

**c**) maximum edge length; (

**d**) number of bends; (

**e**) time per iteration; and (

**f**) total running time. The results for

`ROME4P`are very similar.

**Figure 12.**Absolute results of

`TRAD`and

`FF`for the

`IMDB`: (

**a**) total edge length; (

**b**) area; (

**c**) maximum edge length; (

**d**) number of bends; (

**e**) time per iteration; and (

**f**) total running time. The results for

`IMDB4P`are very similar.

**Figure 13.**Number of bends in the drawings produced by

`FF`for: (

**a**)

`ROME`; and (

**b**)

`QUASI`. The plots for the other test sets show the same behaviour.

**Figure 14.**Relation between additional bends and improvement of area (left) and total edge length (right) for: (

**a**)

`BICON`; and (

**b**)

`IMDB4P`.

**Figure 15.**Relative change of the number of bends (right y-scale) and area and total edge length (left y-scale) for a subset of the Rome graphs: (

**a**) with increasing arc cost; (

**b**) with increasing minimum length for edges to get bend vertices; and (

**c**) with decreasing ratio of the length of an edge to the number of bend vertices on this edge. The whiskers cover 90% of the data, and no outliers are depicted for better readability.

**Figure 16.**(

**a**,

**b**) Rome graph with 97 vertices and 118 edges: (

**a**)

`TRAD`: total edge length 632, area 1326, bends 4; and (

**b**)

`FF`: total edge length 510, area 651, bends 46. (

**c**,

**d**) Biconnected graph with 40 vertices and 55 edges: (

**c**)

`TRAD`: total edge length 126, area 156, bends 7; and (

**d**)

`FF`: total edge length 110, area 120, bends 15. (

**e**,

**f**) The 4-planarized IMDB graph with 136 vertices and 221 edges: (

**e**)

`TRAD`: total edge length 548, area 570, bends 19; and (

**f**)

`FF`: total edge length 518, area 630, bends 39. (

**g**,

**h**) Quasi tree with 100 vertices and 118 edges: (

**g**)

`TRAD`: total edge length 305, area 720, bends 7; and (

**h**)

`FF`: total edge length 248, area 493, bends 33.

© 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Jünger, M.; Mutzel, P.; Spisla, C. More Compact Orthogonal Drawings by Allowing Additional Bends ^{†}. *Information* **2018**, *9*, 153.
https://doi.org/10.3390/info9070153

**AMA Style**

Jünger M, Mutzel P, Spisla C. More Compact Orthogonal Drawings by Allowing Additional Bends ^{†}. *Information*. 2018; 9(7):153.
https://doi.org/10.3390/info9070153

**Chicago/Turabian Style**

Jünger, Michael, Petra Mutzel, and Christiane Spisla. 2018. "More Compact Orthogonal Drawings by Allowing Additional Bends ^{†}" *Information* 9, no. 7: 153.
https://doi.org/10.3390/info9070153