4. POTENCIAL DE GUATEMALA PARA CONVERTIRSE EN PROVEEDOR DE
4.3. Puntos críticos para lograr la competitividad
4.3.5. Atracción de Inversión Extranjera Directa
A layering/leveling of a DAG G = (V, A) is a partition L = hL1, . . . , Lki of V
such that for each arc a = (u, v) with u ∈ Li and v ∈ Lj, i < j holds. Li is
called layer/level and G a layered/leveled DAG with respect to L. The span of a is defined as j − i. If each arc of L has a span of one, then L is a proper
24 Chapter 3. Upward Drawing Algorithms
layering. Otherwise a proper layering can be achieved by splitting each arc a with span greater than one by introducing long arc dummies2 on each layer between i and j. Then the arc a consists of a chain of subarcs. Note that a proper layering is required for the crossing minimization step.
The height of L is the number of layers of L, thus k. The width of a layer Li is the number of regular nodes, that is, original nodes of G, and
long arc dummies. The width of a layering L is the number of nodes of the widest layer of L. In some publications, the width is defined without taking the dummies into account. But since the drawings of the arcs should have a certain distance to the drawings of some neighboring elements, that is, nodes or arcs, the space occupied by long arcs is significant. The definition reflects this fact.
Let Λ be a horizontal line and let Y (Λ) denotes the y-coordinate of Λ. A hierarchical/layered drawing with respect to L is an upward drawing of G such that the drawing of the nodes on layer Li are placed on the i-th horizontal
line Λi and Y (Λi) < Y (Λi+1) for 1 ≤ i < k.
Having regard to the aesthetic criteria area and edge length, the number of long arc dummies, the height, and the width of a layering should be as small as possible. This leads us to a multi criteria optimization task. However, the problem of finding a layering with minimum height when the width is restricted can be reduced to the multiprocessor scheduling problem which is known to be NP-hard (Garey and Johnson [GJ90]; Sugiyama, Tagawa, and Toda [STT81]). Lin showed in his PhD thesis that computing a layering such that the height and the number of long arcs dummies are minimized, is also NP-hard [Lin95]. The problem of layering DAGs with restricted width was investigated by Branke, Leppert and Middendorf [BLME02]. They showed that given a fixed integer w, finding a layering with width w is NP-hard. In addition, they also proved that for two given integers w and h, to decide whether a layering exists for a DAG with width w and height h can be done in polynomial time if at most a constant number of nodes are placed on each layer.
In the following we introduce some algorithms concerning layering DAGs: Longest Path: This classical layering algorithm is based on a longest path
algorithm (Eades and Sugiyama [ES90]; Mehlhorn [Meh84]). It first places each node v with zero out-degree on the top most layer Lk and then removes v and its incident arcs from G. Then the algorithm re- cursively places all nodes with zero out-degree on the next lower layer Lk−1 and stops if G is an empty graph. The longest path heuristic with
runtime O(|V |+|A|), is quite fast. It computes layerings with minimum height, but the algorithm tends to place the nodes to higher layers. Due to this fact, the width of the layering is often unnecessary large (Eades and Sugiyama [ES90]). We denote this heuristic with LongestPath. 2For the sake of convenience, instead of long arc dummies we often just say dummies.
3.1. Framework by Sugiyama, Tagawa, and Toda 25
Promotion Layering: Unlike the other algorithms introduced here, pro- motion layering by Nikolov and Tarassov [NT06] is a post-processing approach which can be applied only on an already obtained layering. It was developed for tackling the problem of unnecessary long arc dum- mies.
For a given layering L, a single promotion step moves a node v from its layer L(v) to a lower layer L(v) − 1. If the layer L(v) − 1 does not exist, then a new layer is added to L. In the case when the upward property is violated, that is, there is a node u with (u, v) and L(u) = L(v), then the promotion step is recursively applied to u. A promotion step is successful if the total number of long arc dummies is reduced thereafter. The promotion layering heuristic performs for each non-source node a promotion step. If the promotion step is successful, then the heuristic continues with the next node, otherwise the layering before the call of the promotion step is restored. The algorithm stops if no successful promotion step can be applied to the non-source nodes of G.
Although promotion layering in combination with LongestPath does not compute a layering with minimum number of dummies, the ex- perimental evaluations of Nikolov and Tarassov reveal quite good re- sults, but compared to an optimal solution (see GKNV-Layering) a small gap still exists. Furthermore, promotion layering needs runtime O(d|V |(|V | + |A|)) where d is the number of dummies of L. In practice it is noticeable slower than the optimal solution GKNV-Layering. Coffman-Graham: This heuristic was developed by Coffman and Graham
originally for the multiprocessor scheduling problem [CG72], but since this problem is closely related to the problem of finding a layering of a DAG with minimum height (see Sugiyama, Tagawa, and Toda [STT81]), it can also be used for layering DAGs.
The heuristic first computes for each node v a priority with respect to the in- and out-degree of v. In this process, nodes with high in-degree are assigned a high priority. For a given fixed number w, the algorithm ”fills” the layers one by one with nodes (starting with a highest prior- itized node). If a layer is full, that is, the number of regular nodes is w, then it continues to fill the next empty layer. A layering of G is obtained after all nodes are distributed. Observe that w is the number of regular nodes, otherwise if w gives the number of regular and dummy nodes, then the NP-hardness of layering a digraph with restricted width w would be contradicted.
According to the published results of Lam and Sethi [LS77], the heuristic computes a layering L such that the height of L is at least (2 −w2hmin)k
where hmin is the minimal height with respect to w. Although the
26 Chapter 3. Upward Drawing Algorithms
the main drawback is that the approach tends to produce layerings with many dummies which can significantly slow down the crossing reduction step. Another flaw is that the input DAG must not contain transitive arcs. Thus a pre-processing step is necessary to transform G into a transitive arc free digraph. This transformation requires runtime O(|V |2) which is also the final runtime.
GKNV: Long arc dummies correspond to the length of the arcs in the final drawing. Further, too many dummies can increase the runtime of the crossing reduction step. Gansner, Koutsofios, North and Vo tackled this problem by an integer linear programming (ILP) approach that computes a layering with the objective to minimize the number of long arc dummies [GKNV93]. It is formulated as follows:
L(u) ≥ 1 for each node u ∈ V (3.1) L(v) − L(u) ≥ 1 for each arc (u, v) ∈ A (3.2) L(v) − L(u) ≥ δ(u, v) for each arc (u, v) ∈ A (3.3)
min X
a=(u,v)∈A
Θ(a)(L(v) − L(u)) subject to (3.1) – (3.3) (3.4)
where L(u) denotes the layer u is assigned to, δ(u, v) the given minimal span of (u, v), and Θ(a) the weight of the arc a. Usually, the weight of each arc and δ(u, v) are set to one. The inequations (3.1)–(3.2) ensure a feasible layering and (3.3) ensures that each arc fulfills the given minimal span. The authors show that the relaxed problem of this integer program has an integer solution, therefore an optimal solution can be computed in polynomial time.
In order to attain a better node distribution over the layers, Gansner et al. proposed to apply a post-processing step called balancing to the obtained layering. In this balancing step, nodes with the same in- and out-degree are reassigned to alternative layers with low width such that the upward property of the layering is not violated. We refer to the GKNV approach in combination with balancing as GKNV-Layering. As shown by our experimental evaluations, GKNV-Layering is quite fast and computes layerings with nearly minimum height. Further- more, the experimental evaluations of Healy and Nikolov [HN02b] reveal that drawings obtained by Sugiyama using GKNV-Layering required less drawing area than when using LongestPath or the approach by Coff- man and Graham.
ILP: Healy and Nikolov investigated the DAG layering problem from the polyhedral point of view. They suggested an ILP [HN02b] and a branch-
3.1. Framework by Sugiyama, Tagawa, and Toda 27
and-cut [HN02a] approach for finding a height and width bounded lay- ering with minimum number of dummies. For this, GKNV-Layering was used to determine feasible upper bounds for height and width. Although both solutions are not practical due to their runtime, the computed re- sults can be used for testing the quality of existing layering heuristics. MinWidth/StretchWidth: Based on the longest path algorithm, Nikolov,
Tarassov, and Branke developed two heuristics called MinWidth and StretchWidth which try to minimize the width of a layering [NTB05]. Both approaches not only take into account the individual width of each nodes, but also the width of the dummies. The behavior of the algorithms can be controlled by a set of variables, that is, by choos- ing appropriate parameters, the number of dummies, the height and the width of a layering can be influenced. In order to improve the re- sults, both algorithms use a modified version of the promotion layering heuristic [NT06] as post-processing step for dummy reduction.
The experimental evaluations of Tarassov et al. [NTB05] reveal that MinWidth with post-processing produces layerings which width is smal- ler than GKNV-Layering, but this advantage is bought dearly by high runtime, more dummies, and layers. Compared to GKNV-Layering, StretchWidth also produces layerings with more dummies and layers and moreover, the average width of the layerings is not significant smaller. We conclude from our study of the published results, that among the described layering algorithms, GKNV-Layering computes the best layering in the sense of compactness, runtime, and number of long arc dummies.