LNCS 3059 - A Heuristic for Minimum-Width Graph Layering with ...

7 downloads 0 Views 202KB Size Report
for hierarchical graph drawing with the minimum width. Our heuristic takes into ..... other was a PC with a Pentium 4/2.4 GHz processor. 4.1 A1, A2, and A3 ...
A Heuristic for Minimum-Width Graph Layering with Consideration of Dummy Nodes Alexandre Tarassov1 , Nikola S. Nikolov1 , and J¨ urgen Branke2 1

2

CSIS Department, University of Limerick, Limerick, Ireland. {alexandre.tarassov,nikola.nikolov}@ul.ie Institute AIFB, University of Karlsruhe, 76128 Karlsruhe, Germany. [email protected]

Abstract. We propose a new graph layering heuristic which can be used for hierarchical graph drawing with the minimum width. Our heuristic takes into account the space occupied by both the nodes and the edges of a directed acyclic graph and constructs layerings which are narrower that layerings constructed by the known layering algorithms. It can be used as a part of the Sugiyama method for hierarchical graph drawing. We present an extensive parameter study which we performed for designing our heuristic as well as for comparing it to other layering algorithms.

1

Introduction

The rapid development of Software Engineering in the last few decades has made Graph Drawing an important area of research. The Graph Drawing techniques find application in visualizing various diagrams, such as call graphs, precedence graphs, data-flow diagrams, ER diagrams, etc. In many of those applications it is required to draw a set of objects in a hierarchical relationship. Such sets are modeled by directed acyclic graphs (DAGs), i.e. directed graphs without directed cycles, and usually drawn by placing the graph nodes on parallel horizontal, concentric or radial levels with all edges pointing in the same direction. There have been recognized a few different methods for hierarchical graph drawing. The more recent two are the evolutionary algorithm of Utech et al. [13] and the magnetic field model introduced by Sugiyama and Misue [11]. While they are an area of fruitful future research, an earlier method, widely known as the Sugiyama (or STT) method, has received most of the research attention and has become a standard method for hierarchical graph drawing. The STT method is a three phase algorithmic framework, originally proposed by Sugiyama, Tagawa, and Toda [12], and also based on work by Warfield [14] and Carpano [3]. At its first phase the nodes of a DAG are placed on horizontal levels; at the second phase the nodes are ordered within each level; and at the final third phase the x− and y− coordinates of all nodes and the eventual edge bends are assigned. The STT method can be employed for drawing any directed graph by reversing the direction of some edges in advance to ensure that there are no directed cycles in the graph and restoring the original direction at the end [6]. C.C. Ribeiro and S.L. Martins (Eds.): WEA 2004, LNCS 3059, pp. 570–583, 2004. c Springer-Verlag Berlin Heidelberg 2004 

A Heuristic for Minimum-Width Graph Layering

571

In order to assign DAG nodes to horizontal levels at the first phase of the STT method it is necessary to partition the node set into subsets such that nodes connected by a directed path belong to different subsets. In addition, it must be possible to assign integer ranks to the subsets such that for each edge the rank of the subset that contains the target of the edge is less than the rank of the subset that contains its source. Such an ordered partition of the node set of a DAG is known as a layering and the corresponding subsets are called layers. A DAG with a layering is called a layered DAG. Figure 1 gives an example of two alternative layerings of the same DAG. Algorithms which partition the node set of a DAG into layers are known as layering algorithms.

(a)

(b)

Fig. 1. Two alternative layerings of the same DAG. Each layer occupies a horizontal level marked by a dashed line. All edges point downwards.

In this paper we propose a new polynomial-time layering algorithm which approximately solves the problem of hierarchical graph drawing with the minimum width. It finds application in the cases when it is necessary to draw a DAG in a narrow drawing area and it is the first successful polynomial-time algorithm that solves this particular problem. We also present the extensive parameter study we performed to design our algorithm. In the next section we formally introduce the terminology related to DAG layering. Then, in Section 3 we present the minimum-width DAG layering problem and the initial rough version of our layering heuristic. In Section 4 we specify further our heuristic trough extensive parameter study and compare it to other well-known layering algorithms. We draw conclusions from this work in Section 5.

2

Mathematical Preliminaries

A directed graph G = (V, E) is an ordered pair of a set of nodes V and a set of edges E. Each edge e is associated with an ordered pair of nodes (u, v); u is the source of e and v is the target of e. We denote this by e = (u, v). We consider only directed graphs where different edges are associated with different node pairs.

572

A. Tarassov, N.S. Nikolov, and J. Branke

The in-degree d− (v) of node v is the number of edges with a target v , and the out-degree d+ (v) of v is the number of edges with a source v. We denote the set − of all immediate predecessors of node v by NG (v) , and the set of all immediate + − + successors of node v by NG (v). That is, NG (v) = {u : (u, v) ∈ E} and NG (v) = {u : (v, u) ∈ E}. The k-tuple of edges p = ((u1 , u2 ), (u2 , u3 ), . . . , (uk , uk+1 )) is called a directed path from node u1 to node uk+1 with length k ≥ 1. If u1 = uk+1 then p is a directed cycle. In the rest of this work we consider only directed acyclic graphs (DAGs), i.e. directed graphs without directed cycles. Let G be a DAG and let L = {L1 , . . . , Lh } be a partition of the node set of G into h ≥ 1 subsets such that if (u, v) ∈ E with u ∈ Lj and v ∈ Li then i < j. L is called a layering of G and the sets L1 , . . ., Lh are called layers. A DAG with a layering is called a layered DAG. We assume that in a visual representation of a layered DAG all nodes in layer Li are placed on the horizontal level with an y-coordinate i. Thus, we say that Lj is above Li and Li is below Lj if i < j. Let l(u, L) denotes the number of a layer which contains node u ∈ V , i.e. l(u, L) = i if and only if u ∈ Li . Then the span of edge e = (u, v) in layering L is defined as s(e, L) = l(u, L) − l(v, L). Clearly, s(e, L) ≥ 1 for each e ∈ E; edges with a span greater than 1 are long edges. A layering of G is proper if s(e, L) = 1 for each e ∈ E, i.e. if there are no long edges. The layering found by a layering algorithm might not be proper because only a small fraction of DAGs can be layered properly and also because a proper layering may not satisfy other layering requirements. In the STT method for drawing DAGs the node ordering algorithms applied after the layering phase assume that their input is a DAG with a proper layering. Thus, if the layering found at the layering phase is not proper then it must be transformed into a proper one. Normally, this is done by introducing so-called dummy nodes which subdivide long edges (see Figure 2). It is desirable that the number of dummy nodes is as small as possible because a large number of dummy nodes significantly slows down the node ordering phase of the STT method. There are also aesthetic reasons for keeping the dummy node count small. A layered DAG with a small dummy node count would also have a small number of undesirable long edges and edge bends. A layering algorithm may also be expected to produce a layering with specified either width and height, or aspect ratio. The height of a layering is the number of layers. Normally the nodes of DAGs from real-life applications have text labels and sometimes prespecified shape. We define the width of a node to be the width of the rectangle that encloses the node. If the node has no text label and no information about its shape or size is available we assume that its width is one unit. The width of a layer is usually defined as the sum of the widths of all nodes in that layer (including the dummy nodes) and the width of a layering is the maximum width of a layer. Usually the width and the height of a layering are used to approximate the dimensions of the final drawing. The edge density between horizontal levels i and j with i < j is defined as the number of edges (u, v) with u ∈ Lj ∪Lj+1 ∪. . .∪Lh and v ∈ L0 ∪L1 ∪. . .∪Li . The edge density of a layered DAG is the maximum edge density between adjacent

A Heuristic for Minimum-Width Graph Layering

573

layers (horizontal levels). Naturally, drawings with low edge density are clear and easier to comprehend.

3

Minimum-Width DAG Layering

Clearly, it is trivial to find a layering of a DAG with the minimum width if the width of a layer is considered equal to the sum of the widths of the original DAG nodes in that layer. In this case any layering with a single node per layer has the minimum width. However, such a definition of width does not approximate the width of the final drawing because the space occupied by long edges is not insignificant (see Figure 2). The contribution of the long edges to the layering width can be taken into account by assigning positive width to the dummy nodes and taking them into when computing the layering width. It is sensible to assume that the dummy nodes occupy smaller space than the original DAG nodes especially in DAGs which come from practical applications and may have large node labels.

Fig. 2. A hierarchical drawing of a DAG. The black circles are the original DAG nodes and the smaller white squares are the dummy nodes along long edges. All edges point downwards.

It is NP-hard to find a layering with the minimum width when the contribution of the dummy nodes is taken into account [2]. The first attempt to solve this problem by a heuristic algorithm belongs to Branke et al. [1]. They proposed a polynomial-time heuristic which did not meet their expectations about quality when tested with relatively small graphs. To the best of our knowledge the only method that can be used for minimum-width DAG layering is the branch-andcut algorithm of Healy and Nikolov which takes as an input an upper bound on the width and produces a layering subject to it (if feasible) [8]. Although exact, the algorithm of Healy and Nikolov is very complex to implement and its running time is exponential in the worst case. In this work we design a simple polynomial-time algorithm which finds narrow layerings. We call it MinWidth. Similar to the algorithm of Branke et al. it is a heuristic and it does not guarantee the minimum width. Nevertheless it produces layerings which are narrower than the layerings produced by any of the

574

A. Tarassov, N.S. Nikolov, and J. Branke

known polynomial-time layering algorithms. In the remainder of this section we introduce the initial rough version of MinWidth which we tune and extensively test in Section 4. 3.1

The Longest-Path Algorithm

We base MinWidth on the longest-path algorithm displayed in Algorithm 1. The longest-path algorithm constructs layerings with the minimum height equal to the number of nodes in the longest directed path. It builds a layering layer by layer starting from the bottom layer labeled as layer 1. This is done with the help of two node sets U and Z which are empty at start. The value of the variable current layer is the label of the layer currently being built. As soon as a node gets assigned to a layer it is also added to the set U . Thus, U is the set of all nodes already assigned to a layer. Z is the set of all nodes assigned to a layer below the current layer. A new node v to be assigned to the current layer is picked among the nodes which have not been already assigned to a layer, i.e. v ∈ V \ U , and which have all their immediate successors assigned to the layers + below the current one, i.e. NG (v) ⊆ Z. Algorithm 1 The Longest-Path Algorithm(G) Requires: DAG G = (V, E) U ←φ Z←φ currentLayer ← 1 while U = V do + Select node v ∈ V \ U with NG (v) ⊆ Z if v has been selected then Assign v to the layer with a number currentLayer U ← U ∪ {v} end if if no node has been selected then currentLayer ← currentLayer + 1 Z ←Z ∪U end if end while

3.2

A Rough Version of MinWidth

In the following, we will assume that all dummy nodes have the same width, wd , although our considerations can be easily generalized to variable dummy node widths. We will also assume that w(v) is the width of node v. We start with an initial rough version of MinWidth, displayed in Algorithm 2, which

A Heuristic for Minimum-Width Graph Layering

575

Algorithm 2 MinWidth(G) Requires: DAG G = (V, E) U ← φ; Z ← φ currentLayer ← 1; widthCurrent ← 0; widthU p ← 0 while U = V do + Select node v ∈ V \ U with NG (v) ⊆ Z and ConditionSelect if v has been selected then Assign v to the layer with a number currentLayer U ← U ∪ {v} widthCurrent ← widthCurrent − wd ∗ d+ (v) + w(v) Update widthU p end if if no node has been selected OR ConditionGoUp then currentLayer ← currentLayer + 1 Z ←Z ∪U widthCurrent ← widthU p Update widthU p end if end while

contains a number of unspecified parameters. We specify them later in Section 4 by extensive parameter study. We employ two variables widthCurrent and widthUp which are used to store the width of the current layer and the width of the layers above it respectively. The width of the current layer, widthCurrent, is calculated as the sum of the widths of the nodes already placed in that layer plus the sum of the widths of the potential dummy nodes along edges with a source in V \ U and a target in Z (one dummy node per edge). The variable widthUp provides an estimation of the width of any layer above the current one. It is the sum of the widths of the potential dummy nodes along edges with a source in V \ U and a target in U (one dummy node per edge). When we select a node to be placed in a layer we employ an additional condition ConditionSelect. Our intention is to specify ConditionSelect so that the choice of node v (among alternative candidates) will lead to as narrow a layering as possible. We propose to explore the following three alternatives as ConditionSelect: – A1 : v is the candidate with the maximum outdegree d+ (v); – A2 : v is the candidate with the maximum d+ (v) − d− (v); – A3 : v or any immediate predecessor of v has the maximum d+ (v) − d− (v) among all candidates and their immediate predecessors. In A1 we select the candidate with the maximum indegree because that choice will lead to the maximum possible improvement of widthCurrent. A2 and A3 are less greedy alternatives which do not make the best choice in terms of widthCurrent but look also at the effect to the upper layers. By choosing the

576

A. Tarassov, N.S. Nikolov, and J. Branke

candidate with the maximum d+ (v) − d− (v) A2 makes the choice that will bring the best improvement to widthUp. The idea behind A3 is to allow nodes which can bring big improvement to the width of some upper layer to do it without being blocked by their successors with low d+ (v) − d− (v). Thus, A3 represents an alternative that tries to choose a node by looking ahead at the impact of that choice to the layering width. In order to control the width of the layering we introduce a second modification to the longest-path algorithm. That is, we introduce an additional condition for moving up to a new layer, ConditionGoUp. The idea is to move to a new layer if the width of the current layer or of the layer above it becomes too large. In order to be able to check this we introduce the parameter U BW against which we would like to compare the width of the current layer. Since widthUp represents only an approximation of the width of the layers above the current layer we propose to compare its width to c × U BW where c ≥ 1, i.e. c gives freedom to widthUp to be larger than widthCurrent because widthUp is just an estimation of the width of the upper layers. We do not consider U BW and c as input parameters, we would like to have their values (or narrow value ranges) hard-coded in MinWidth instead. We set up ConditionGoUp to be satisfied if either: – widthCurrent ≥ U BW and d+ (v) < 1, or – widthUp ≥ c × U BW . We require d+ (v) < 1 for widthCurrent ≥ U BW to be taken into account because the initial value of widthCurrent is determined by the dummy nodes in the current layer and it gets smaller (or at least it does not change) when a regular node with a positive outdegree gets placed in the current layer. In that case the dummy nodes along edges with a source v are removed from the current layer and get replaced by v. If d+ (v) ≥ 1 then the condition widthCurrent ≥ U BW on its own is not a reason for moving to the upper layer because there is still a chance to add nodes to the current layer which will reduce widthCurrent. If d+ (v) < 1 then the assignment of v to the current layer increases widthCurrent because it does not replace any dummy nodes. This is an indication that no further improvement of widthCurrent can be done. In relation to the three alternatives, A1 , A2 , and A3 , we consider two alternative modes of updating the value of widthUp: – Set widthUp at 0 when move to the upper layer; add wd × d− (v) to widthUp each time a node v is assigned to the current layer; – Do not change widthUp when move to the upper layer; add wd × (d− (v) − d+ (v)) to widthUp each time a node v is assigned to the current layer . The first of the two modes builds up widthUp starting from zero 0 and taking into account only dummy nodes along edges between V \U and the current layer. We employ this update mode with A1 . The second mode approximates the width of the upper layers more precisely by keeping track of as many dummy nodes as possible. We employ it with A2 and A3 where the width of the upper layers

A Heuristic for Minimum-Width Graph Layering

577

plays more important role. We consider the three alternatives A1 , A2 , and A3 with the corresponding widthUp update modes as parallel branches in the rough version of MinWidth and we choose one of them as a result of our experimental work. In order to specify ConditionGoUp we need to set UBW and c. To specify ConditionSelect we need to select one of A1 , A2 and A3 . We propose to run MinWidth for 5911 test DAGs and various sets of values of UBW and c as well as for each of the alternatives A1 , A2 or A3 with the corresponding widthUp update mode. We expect that the extensive experiments will suggest the most appropriate values or ranges of values for UBW and c as well as the winner among the alternatives A1 , A2 or A3 .

4

Parameter Study

In our experimental work we used 5911 DAGs from the well-known Rome graph dataset [5]. The Rome graphs come from practical applications. They are graphs with node count between 10 and 100 nodes and typically each of them has twice as many edges as nodes. We run MinWidth with each of the three alternatives A1 , A2 , and A3 , for each of the 5911 DAGs and for each pair (UBW, c) with UBW = 1..50, and c = 1..10. In total, we had about 9 million tasks. We executed the tasks in a computational grid environment with two computational nodes. One of the computational nodes was a PC with a Pentium III/800 MHz processor, and the other was a PC with a Pentium 4/2.4 GHz processor. 4.1

A1 , A2 , and A3 Compared

For each of the 5911 input DAGs and each alternative - A1 , A2 , and A3 - we chose the layering with the smallest width (taking into account the dummy nodes) and stored the pair of parameters (UBW, c) for which it was achieved. As we stated above, we explored any combination of UBW with = 1..50, and c = 1..10. Figures 3-8 compare various properties of the stored layerings. The x-axis in all pictures represents the number of original nodes in a graph. Since the Rome graphs have no node labels we assume that the width of all original and all dummy nodes is 1 unit if not specified otherwise. Thus, the layering width is the maximum number of nodes (original and dummy) per layer. We have partitioned all DAGs into groups by node count. Each group covers an interval of size 5 on the x-axis. We display the average result for each group. Figures 3(a) and (b) compare the width of the layerings taking into account the dummy nodes (i.e. each dummy node has width equal to one unit) and neglecting them (i.e. each dummy node has width equal to zero) respectively. In both cases A1 gives the narrowest layerings which suggests that A1 might be the best option if the width of the dummy nodes is considered less than or equal to one unit (which is a reasonable assumption). The height of the A1 layerings (see Figure 4) is larger than the height of the other layerings. The height is the number of layers. It was expected that the narrower a layering, the larger is the

578

A. Tarassov, N.S. Nikolov, and J. Branke

18 Layering Width (excluding Dummy Nodes)

Layering Width (including Dummy Nodes)

40 35 A1 A2 A3

30 25 20 15 10 5 0

16 A1 A2 A3

14 12 10 8 6 4 2

10

20

30

40

50

60

70

80

90

100

10

20

30

40

Node Count

50

60

70

80

90

100

Node Count

(a)

(b)

Fig. 3. A1 , A2 , and A3 compared: layering width (a) taking into account and (b) neglecting the contribution of the dummy nodes.

40 35 A1 A2 A3

Layering Height

30 25 20 15 10 5 10

20

30

40

50

60

70

80

90

100

Node Count

Fig. 4. A1 , A2 , and A3 compared: layering height (number of layers).

number layers. Figure 5(a) shows the dummy node count divided by the total node count in a DAG. Figure 5(b) shows the edge density divided by the total edge count in a DAG. We can observe that the A1 layerings have fewer dummy nodes and in general better edge density than the A2 and the A3 layerings. Similarly, Figures 6(a) and (b) show the values of UBW and c which lead to narrowest layerings. The simplest A1 alternative finds narrowest layerings for considerably lower values of UBW and c than A2 and A3 . Moreover, those values of UBW and c do not depend on the DAG size when A1 is employed. The conclusion that we can make from these experiments is that the simplest alternative, A1 , is superior to the other two. It is enough to run MinWidth with A1 , UBW = 1..4 and c = 1..2 in order to achieve the narrowest possible layerings. In any case MinWidth leads to layerings with a very high dummy node count. There is a simple heuristic that can be applied to a layering in order to reduce the dummy node count. It is the Promotion heuristic which works by iteratively moving (or promoting) nodes to upper layers if that movement decreases

A Heuristic for Minimum-Width Graph Layering

45

8

40 A1 A2 A3

7 6

Edge Density (normalized)

Number of Dummy Nodes (normalized)

9

579

5 4 3 2

A1 A2 A3

35 30 25 20 15 10

1 0

5 10

20

30

40

50

60

70

80

90

100

10

20

30

40

Node Count

50

60

70

80

90

100

Node Count

(a)

(b)

20

3 Values of c that lead to smallest width values

Values of UBW that lead to smallest width values

Fig. 5. A1 , A2 , and A3 compared: normalized values of (a) the dummy node count and (b) the edge density.

18 A1 A2 A3

16 14 12 10 8 6 4 2

A1 A2 A3

2.5

2

1.5

1 10

20

30

40

50

60

70

Node Count

(a)

80

90

100

10

20

30

40

50

60

70

80

90

100

Node Count

(b)

Fig. 6. A1 , A2 , and A3 compared: values of (a) UBW and (b) c for which a narrowest layering was found.

the dummy node count [9]. The Promotion heuristic leads to close to the minimum dummy node count when applied to longest-path layerings. Since MinWidth is based on the longest-path algorithm we expected that the same Promotion heuristic might be successfully applied to MinWidth layerings as well. In the next section we compare MinWidth with A1 followed by the Promotion heuristic to some well-known layering algorithms. 4.2

Effect of Promotion

Figures 6(a) and (b) suggest that when A1 is employed it is enough to consider UBW = 1..4 and c = 1..2. Since MinWidth is very fast with fixed UBW and c, we can afford running it for relatively narrow ranges of UBW and c values for better quality results. Thus, in a new series of experiments we run MinWidth with A1

580

A. Tarassov, N.S. Nikolov, and J. Branke

for UBW = 1..4 and c = 1..2, and choose the combination (U BW, c) that leads to the narrowest layering. For convenience, we call the layering achieved by this method simply MinWidth layering in the remainder of this section. We post-processed MinWidth layerings by applying to them the Promotion heuristic modified to perform a node promotion only if it does not increase the width of the layering. We also run the longest-path algorithm and the Coffman-Graham algorithm followed by the same width-preserving node promotion. The Coffman-Graham algorithm takes an upper bound m on the number of nodes in a layer as an input parameter [4]. Thus, we run it for m = 1..n, where n is the number of nodes in the DAG, and chose the narrowest layering. We also run the network simplex algorithm of Gansner et al. [7] and compared the aesthetic properties of the four layering types: MinWidth, longest-path, Coffman-Graham and Gansner’s network simplex. The results of the comparison are presented in Figures 7-10.

20

45

Layering Width (excluding Dummy Nodes)

Layering Width (including Dummy Nodes)

50 MinWidth + Promotion Longest Path + Promotion Coffman-Graham + Promotion Gansner’s Network Simplex

40 35 30 25 20 15 10 5 0

18

MinWidth + Promotion Longest Path + Promotion Coffman-Graham + Promotion Gansner’s Network Simplex

16 14 12 10 8 6 4 2

10

20

30

40

50

60

Node Count

(a)

70

80

90

100

10

20

30

40

50

60

70

80

90

100

Node Count

(b)

Fig. 7. Effect of promotion: layering width (a) taking into account and (b) neglecting the contribution of the dummy nodes.

It can be observed that the promotion heuristic is very efficient when applied after MinWidth. MinWidth leads to considerably narrower but taller layerings than the other three algorithms (see Figures 7(a) and (b)). It was expected that the narrower a layering, the larger is the number of layers. This can be confirmed in Figure 10(a). The number of dummy nodes in the MinWidth layerings is close to the number of dummy nodes in the Coffman-Graham layerings and slightly higher than the number of dummy nodes in the longest-path and Gansner’s layerings as it can be seen in Figure 8(a). However, Figure 8(b) shows that the MinWidth layerings have considerably lower edge density than the other layerings which means that they could possibly lead to clean drawings with small number of edge crossings. The number of edge crossings is widely accepted as one of the most important graph drawing aesthetic criteria [10].

A Heuristic for Minimum-Width Graph Layering

55 50

MinWidth + Promotion Longest Path + Promotion Coffman-Graham + Promotion Gansner’s Network Simplex

2.5

MinWidth + Promotion Longest Path + Promotion Coffman-Graham + Promotion Gansner’s Network Simplex

45 Edge Density (normalized)

Number of Dummy Nodes (normalized)

3

581

2

1.5

1

40 35 30 25 20 15

0.5

10 0

5 10

20

30

40

50

60

70

Node Count

(a)

80

90

100

10

20

30

40

50

60

70

80

90

100

Node Count

(b)

Fig. 8. Effect of promotion: normalized values of (a) the dummy node count and (b) the edge density.

(a) MinWidth

(b) Gansner’s

Fig. 9. Two layerings of the same DAG. The MinWidth layering is narrower than the Gansner’s layering (assuming all DAG nodes and all dummy nodes have width one unit). All edges point downwards.

Figure 9 shows an example of the MinWidth layering of a DAG compared to the Gansner’s layering of the same DAG. The DAG is taken from the Rome’s graph dataset. We run the second group of experiments on a single Pentium 4/2.4 GHz processor. The running times are presented in Figure 10(b). We observed that the average running time for MinWidth followed by promotion is up to 2 seconds for DAGs having no more than 75 nodes and it grows up to 6.2 seconds for DAGs with more than 75 and less than 100 nodes. The total running time

582

A. Tarassov, N.S. Nikolov, and J. Branke

for the Coffman-Graham algorithm was within 3 seconds and the longest-path algorithms was the fastest of the three with running time within 2 seconds. The Gansner’s layerings (which we computed with ILOG CPLEX) are the fastest to be computed.

7 Running time on a single processor (seconds)

26 24 MinWidth + Promotion Longest Path + Promotion Coffman-Graham + Promotion Gansner’s Network Simplex

22 Layering Height

20 18 16 14 12 10 8 6

6

MinWidth + Promotion Longest Path + Promotion Coffman-Graham + Promotion Gansner’s Network Simplex

5 4 3 2 1 0 -1

10

20

30

40

50

60

Node Count

(a)

70

80

90

100

10

20

30

40

50

60

70

80

90

100

Node Count

(b)

Fig. 10. Effect of promotion: (a) layering height and (b) running times in seconds.

5

Conclusions

Our parameter study shows that MinWidth with A1 , UBW = 1..4, c = 1..2, and followed by width-preserving node promotion can be successfully employed as a heuristic for layering with the minimum width taking into account the contribution of the dummy nodes. This is the first successful attempt to design a heuristic for the NP-hard problem of minimum-width DAG layering with consideration of dummy nodes. It does not guarantee the minimum width but performs significantly faster than the only other alternative which is the exponential-time branch-and-cut algorithm of Healy and Nikolov. The aesthetic properties of the MinWidth layerings compare well to the properties of the layerings constructed by the well-known layering algorithms. The MinWidth layerings have the lowest edge density which suggests that they could lead to clear and easy to comprehend drawings in the context of the STT method for hierarchical graph drawing. It has to be noted that the promotion heuristic slows down the computation significantly but the running time is still very acceptable for DAGs with up to 100 nodes. The work we present can be continued by exploring other possibilities for the conditions we set up in MinWidth. However, we believe that MinWidth finds layerings which are narrow enough for practical applications. Further research could be related to the optimization of the running time of MinWidth and to experiments with larger DAGs and with DAGs with variable node widths.

A Heuristic for Minimum-Width Graph Layering

583

References 1. J. Branke, P. Eades, S. Leppert, and M. Middendorf. Width restricted layering of acyclic digraphs with consideration of dummy nodes. Technical Report No. 403, Intitute AIFB, University of Karlsruhe, 76128 Karlsruhe, Germany, 2001. 2. J. Branke, S. Leppert, M. Middendorf, and P. Eades. Width-restriced layering of acyclic digraphs with consideration of dummy nodes. Information Processing Letters, 81(2):59–63, January 2002. 3. M. J. Carpano. Automatic display of hierarchized graphs for computer aided decision analysis. IEEE Transactions on Systems, Man and Cybernetics, 10(11):705– 715, 1980. 4. E. G. Coffman and R. L. Graham. Optimal scheduling for two processor systems. Acta Informatica, 1:200–213, 1972. 5. G. Di Battista, A. Garg, G. Liotta, R. Tamassia, E. Tassinari, and F. Vargiu. An experimental comparison of four graph drawing algorithms. Computational Geometry: Theory and Applications, 7:303–316, 1997. 6. P. Eades, X. Lin, and W. F. Smyth. A fast and effective heuristic for the feedback arc set problem. Information Processing Letters, 47:319–323, 1993. 7. E. R. Gansner, E. Koutsofios, S. C. North, and K.-P. Vo. A technique for drawing directed graphs. IEEE Transactions on Software Engineering, 19(3):214–230, March 1993. 8. P. Healy and N. S. Nikolov. A branch-and-cut approach to the directed acyclic graph layering problem. In M. Goodrich and S. Koburov, editors, Graph Drawing: Proceedings of 10th International Symposium, GD 2002, volume 2528 of Lecture Notes in Computer Science, pages 98–109. Springer-Verlag, 2002. 9. N.S. Nikolov and A. Tarassov. Graph layering by promotion of nodes. Special issue of Discrete Applied Mathematics associated with the IV ALIO/EURO Workshop on Applied Combinatorial Optimization, to appear. 10. H. C. Purchase, R. F. Cohen, and M. James. Validating graph drawing aesthetics. In F. J. Brandenburg, editor, Graph Drawing: Symposium on Graph Drawing, GD ’95, volume 1027 of Lecture Notes in Computer Science, pages 435–446. SpringerVerlag, 1996. 11. K. Sugiyama and K. Misue. Graph drawing by the magneting spring model. Journal of Visual Languages and Computing, 6(3):217–231, 1995. 12. K. Sugiyama, S. Tagawa, and M. Toda. Methods for visual understanding of hierarchical system structures. IEEE Transaction on Systems, Man, and Cybernetics, 11(2):109–125, February 1981. 13. J. Utech, J. Branke, H. Schmeck, and P. Eades. An evolutionary algorithm for drawing directed graphs. In Proceedings of the 1998 International Conference on Imaging Science, Systems, and Technology (CISST’98), pages 154–160, 1998. 14. J. N. Warfield. Crossing theory and hierarchy mapping. IEEE Transactions on Systems, Man and Cybernetics, 7(7):502–523, 1977.

Suggest Documents