Computer
Aided Layout of Entity Relationship
Diagrams
C. Batini Universitri di Roma
M. Talamo IASI, Roma, Italy
R. Tamassia Universitd di Roma
An algorithm is presented that allows computer aided layout of entity relationship diagrams on a grid. A standard for the representation of symbols is introduced and aesthetic criteria that should be achieved by a layout algorithm are proposed. The algorithm makes use of some heuristic step for the critical activities. Finally, an algorithm for restructuring of previously defined diagrams is presented.
INTRODUCTION
The aim of this paper is to describe an algorithm for layout of entity relationship (ER) diagrams. The algorithm accepts as input an ER schema described in a nongraphical representation and produces a corresponding graphical diagram. The algorithm is one of the main features of GINCOD, a graphical tool for the design of data base applications, whose design is in progress [ 31. It is usual (especially after [ 131) to see a methodology for the design of data base applications as divided into four phases:
specifications, collected and analyzed during the previous phase, are formally represented into a conceptual schema. The general philosophy of the tool is influenced by previous work on INCOD, a tool for conceptual design that does not make use of a graphical representation [ 1, 21. The reasons for developing new research efforts in this area are the following: While developing INCOD we felt that several features specific of conceptual design could be much better embedded in a tool in case it had a graphical capability. At the same time we began to develop methodologies for data base design [4, 51, and, refining our ideas, we were confirmed in the above position.
The tool we describe in this paper concerns the second phase, conceptual design, in which the informal
The conceptual model used in INCOD is an enriched version of the entity relationship model [6]. A generalization abstraction capability is added to the original model, expressed by means of the concepts of generalization, subset, underlying attribute [ 11. INCOD allows the designer to incrementally specify the conceptual schema by means of a set of design commands. Such commands may describe new concepts to be added to a single schema (INTRASCHEMA COMMANDS), or refer to pairs of schemata to be integrated (INTERSCHEMA COMMANDS). GINCOD may be seen as a graphical interface for INCOD. Its main goals are the following:
Address correspondence to C. Batini. Dipartimento di I/ormatica e Sistemistica, Universitb di Roma-Via Buonarroti, 1200185 Roma, Italy.
1. First, by means of a layout tool, it is able (having at disposal an internal representation of the conceptual schema) to produce an equivalent diagrammatic representation (see Figure 1).
user requirements analysis conceptual design logical design physical design.
The Journal of Systems and Software 4, 163- 173 (1984) 0 Elsevicr Science Publishing Co., Inc., 1984
163 0164-1212/84/$3.00
164
2. Since the internal representation
is incrementally updated, it may be convenient, when the change in the diagram is simple, to use a restructuring tool that produces the new one, since it has at its disposal the old diagrammatic representation.
Layout algorithms are widely used in several research areas, like VLSI design and architectural design. The rapid evolution from integrated circuits technology to larger and more complex circuits requires the application of computer aids for layout design; in recent years a great effort has been done in developing algorithms for layout generation. Geometric layout rules are due to chip production tolerances derived from photolith~ graphic limits, mask alignment, oxidation, and device physics limitations. The main goals of VLSI layout are minimizing circuit area and the peak of the crossing count; a third goal, minimizing the wire length of all combined connections, is now of less and less importance [ 161. A general overview of the circuit layout and CAD techniques for layout design can be found in [ 14, 161. Entity relationship diagrams look very different from integrated circuits. With regard to structural aspects, the underlying model of an ER diagram is one plane drawing, while for integrated circuits we need several plane drawings (corresponding to the different masks) that interact the one with the other. Second, ER diagrams are much more sparse, and each object has usually a limited number of connections with other objects. With regard to layout goals, aesthetic features are much more im~rtant in ER diagrams, since they give a conceptual description of data that has to be easily understandable both by the user and by the designer. In architectural design research has been done in optimal floor plan layout problems. The objective of such algorithms is to locate a set of activities in a floor of a building such that operating efficiency is maximized. Operating efficiency is defined in terms of contiguity among activities among which strongest interaction exists. Furthermore, area requirements (e.g., minimum square footage) and shape constraints must be taken into account. This spatia1 allocation problem can be formulated as
C. Batini et al. a quadratic assignment problem [ 121, that has been proved to be NP-complete [9]. Approximate solution strategies have been developed that produce good solutions for realistically sized problems. Graph-oriented mathematical formulations [ 171 have been also investigated. Initially a graph is constructed, whose vertices are the activities and whose edges represent interaction, or continguity request, between pairs of activities. This graph is then planarized by elimination of some edges. The new graph so obtained represents now adjacencies physically feasible in a floor plan layout. A floor plan layout that respects adjacencies expressed by this graph and is optimal with respect to efficient space utilization is finally selected by means of linear integer programming techniques. The approach that we follow in our algorithm is inspired by such graph oriented formulation. The paper is organized as follows. First we will describe graphic conventions adopted in the diagrammatic representation. We will state the aesthetic criteria that can be assumed to hold for diagrams in order to approach the way in which human beings tend to represent ER diagrams. We then describe step by step the algorithm used in the layout tool and discuss its complexity and its fitting with the above mentioned criteria. We describe the algorithm used in the restructuring tool. And finally, we discuss further research and developments. GRAPHIC CONVENTIONS
In this section we describe a graphic standard for ER diagrams. First of all we assume that a reference grid exists in which the schema is embedded; to each symbol one or more cells of the grid are associated, according to the following conventions. Connections are represented by means of continuous lines. Lines representing connections can be straight or broken. In both cases they are placed parallel to grid axes. At most, two connections may appear in a cell: when two connections appear they must be orthogonal, and one of the two connections is cut off at the crossing point. Finally, a cell that contains connections cannot contain symbols. As a consequence of the above rules concerning connections, a cell of the grid that contains connections is represented as in Figure 2. Entities, relationships and attributes are represented as in Table 1. Attributes may be optionally represented. When attributes are not represented, an entity fills an area in the grid whose shape depends on the number of con-
165
Computer Aided Layout r--
r------i
‘I
I I_______~
I
i
L__
---I
I: ____
Figure 2. Shapes of a cell that contains connections.
nections. It can be seen in Table 2 that there is correspondence between the shape of the area and the number of connections n, when n 5 10. The general law can be easily expressed by means of recursion. When attributes are represented, the vertical dimension of the entity depends also on the number of attributes of the entity, since they are placed on the left and right side of the entity, intermixed with connections. Relationships are represented, as usual, by means of diamond shaped boxes. Only relationships with n < = 4 connections are accepted. To each symbol of type relationship a unique cell is associated. In Figures 3 and 4 we show an ER diagram (with and without attributes) that follows the above stanTable 1. The Diagrammatic Representation.
Object
Representation
Entity El
Relationship 0 Attribute
dards. Notice in Figure 4 that space is left for the names of attributes.
AESTHETIC CRITERIA
It is an hopeless matter to define formally what pleasant ER diagram and what is not. In any case, eral aesthetic criteria may be identified. Research to be done in order to choose effective criteria and their relevance in a real environment. We assume the following criteria:
is a sevhas test
C 1. minimization of crossings between connections C2. minimization of the global number of bends in connection lines C3. minimization of the global length of connections C4. equality of the length of connections between relationship boxes and related entity boxes In general, given an ER schema, no corresponding diagram exists optimal with respect to all of the above criteria. In Figures 5 and 6 two diagrams representing the same schema are shown that optimize, respectively, criteria Cl and C2. It is easy to see that no diagram exists that optimizes both criteria.
0
Table 2. Relationship between Number of Connections of an Entity and Shape of Its Realted Area.
Figure 3. An ER diagram without attributes according to our conventions.
C. Batini et al.
Figure 4. The diagram of Figure 3 with
attributes.
diagrammatic representation according to conventions described in the second section. The algorithm is composed of five steps (see Figure 7):
Figure 5. Diagram fitting C2.
1. Modeling-a user-oriented description of the ER schema is transformed in a c-graph: A c-graph is a mathematical representation of an ER schema in which all the entities and relationships with n > 2 connections are represented by vertices, while relationships between pairs of entities collapse in edges. This is done in order to improve the efliciency of sub sequent steps. Figure 7. The five steps of the layout algorithm.
A
D
‘n *e c
Figure 6. Diagram fitting Cl.
0
C
THE LAYOUT ALGORITHM Outline of the Layout Algorithm
In this section we describe an outline of the layout algorithm. The algorithm receives as input a nongraphical representation of the ER schema and produces as output a
-+_._+-~-+-e+-
-p$%Jj-:_._+-.:--A-.
_V‘_
t-
,--I
??-g!g
_+-_+__+--+ _+-_,__J--l
167
Computer Aided Layout 2. Planarizatiom starting from the c graph, one of its planar representations is generated, if it exists. Otherwise, edges that cause the nonplanarity are removed, the planar representation of the remaining subgraph is generated, and finally nonplanar edges are superimposed to the planar representation introducing as few new nodes as possible at the crossing points (criterion Cl). 3. Normalization: First of all a normalized planar representation is produced in which each vertex has degree n 5 4. Subsequently, an orthogonal representation is produced in which each face of the normalized representation appears with the shape of a rectangled polygon with the minimum number of bends in its lines (criterion C2). 4. Compaction: the orthogonal representation is embedded in the grid (we call such representation grid graph) and the global length of connections of the resulting grid graph is minimized (criterion C3). 5. Drawing: the grid graph is tranformed in the final ER diagram.
For this simple step we show in Figure 9 the procedure in a Pascal-like formalism. The output of step 1 for our example is shown in Figure 10. Step 2: Planarization. Step 2 receiving as input a c graph Gl produces a planar representation G2 (Figure 10). A planar representation is a graph drawn in the plane that has no intersections between edges. A graph is said to be planar if it has a corresponding planar representation. In Figure 11 a planar graph and one of its corresponding planar representations is shown. In order to represent nonplanar graphs in the plane we are forced to introduce new nodes and edges. New nodes, crossing-nodes in the following, represent crossings that necessarily are produced in a plane drawing of the graph. New edges come from splitting old edges at crossing points. In Figure 12 a nonplanar graph and two of its related planar representations is shown. The problem of finding one of the planar representations of a nonplanar graph with minimum number of crossing nodes has been proved in [lo] to be NP hard.
The Algorithm
We describe the algorithm in the case attributes not taken into account; when attributes are considered the normalization and compaction steps must be slightly modified. The input of the layout algorithm is a conceptual schema expressed by the pair (ENT,REL) where:
PROCEDURE BUILD-C-GRAPH (ENT.REL,V,E); begin V:=ENT; E:=0; for each r t REL do if IS(r)/ = 2 then E:=E US(r) else begin v:=v u lr); for each e t S(r) do E:=E U (r,e) end end;
1. ENT is the set of entities. 2. REL is a pair (R,S) where R is the set of relationships and S is a function that maps each relationship r into the corresponding multiset S(r) of entities involved in the relationship. In Figure 8 we show an user-oriented description of an input schema, used in Figure 8 as an example. The output of the algorithm is a diagram that agrees with the conventions of the second section. We now describe in detail the five steps of the algorithm. Step 1: Modeling. The goal of step 1 is to simplify the graph description of the conceptual schema. This is achieved by collapsing in edges the relationships between pairs of entities, obtaining a new graph Gl = (V,E) called in the following c graph.
Figure 9. Step 1.
v=
CA.B.C.0.E.F.G.S.T)
E = ((A.6 , (A&), (A.G). (R.C). (R.G). (CJ) (C,T1 , (D,E). (D.T). (E.T). (f.5). (G.S)J
Figure 10. c graph output of Step 1.
Figure 11. A representations.
planar
graph
and
one
of its
PLANAR GRAPH G = (V.E) " = (1,2,3.4) E = {(,,2). (1.3). (1.4). (2.3). (2.4)s (3.4))
Figure 8. An input schema example. ENTITY IS A, E. C. D, E. F, G; RELATIONSHIP IS Q(C.E). R(E,O). s(C,G,F), T(C,O,E), U(6.G). Y(A,G), W(A.6). Z(A.C);
planar
C. Batini et al. NDNPLANAR GRAPH G = tV.EI
PROCEDURE ROD-CROSSINGS (G*,E',GZ)
v = 11,2,3,4,5) E = ~(1,~),(1,3),(1,4),(1,5),(2,3),(2,4).(2,S).(3~4)~(3~5),(4~S)~
begin
end:
FIND a planar representation PG* of G*; GP:=PG*; (at this step GZ=(V,E*)) foreacheEE'do begin among all possible paths that result by superimposing e to 62 CHOOSE one with minimum number of intersections with preexisting edges; for each intersection do add a new node and the resulting edges to 62 end
Figure 15. Figure 12. A nonplanar graph and two of its planar
representations.
We show in Figure 13 a first global description of step 2. Procedure DECOMPOSE is described in Figure 14. BLOCK-DECOMPOSE partitions graph G 1 into its blocks [I 11, i.e., two connected or nonseparable components. BLOCKS is the set of blocks G[i] of Gl. PLANARIZE finds maximal planar subgraph G*[i] and the set of irreducible edges E’[i] of the twoconnected graph G[i]. Procedure BLOCK-DECOMPOSE may be implemented by means of a well-known algorithm [8] that performs the task using a depth-first search technique in 0( ]E]) time. Procedure PLANARIZE is based on Chiba-Nishioka-Shirakawa algorithm [ 71, whose complexity is O(]Vl X ]E]) time. Procedure ADD-CROSSING is shown in Figure 15. Step FIND looks for a planar representation that minimizes the number of nested faces [see in Figure 16 two planar representations of the graph in Figure 10, in the planar representation (b) face TDET is nested in face BCTDETCSGB] . Step FIND builds a tree representation of the block structure of Cl. The root of the tree is the block of maximum size: sons are recursively generated choosing 1. DECOMPOSE (G1.GI.E') {G*=(V.E*) is a maximal planar subgraph of Gl. i.e. for any e E E-E* the graph G'=(V,E*Ule)) is non planar1 {E' is the set of irreducible edges E-E*) 2. ADD-CROSSINGS (G+.E',GZ) 162 is a planar representation obtained from G* adjoining edges in E' by means of a heuristic procedure)
Figure 13. Global description of Step 2. Figure 14. PROCEDURE DECOMPOSE (Gl,G*,E'); begin
end:
BLOCK-OECOMPOSE (Gl,BLOCKS); for each GliltBLOCKS do PLANARlZE (G[il,G*[il,E'[il); E':=Uj E'[il; G*:=(V,E-E')
D
E T
F
C 5 B A
% (a)
G
Ib’
Figure 16. Two planar representations of the graph in Figure 10.
blocks which have a cut-point f 111 in common with the father. Starting from the root, planar representations of blocks are built selecting the external face as the face with the maximum number of cut-points. Step CHOOSE, applied to edge e = (v,w) can be afforded building first of all the dual graph [ 111 GD of G2 and looking for a shortest path, from the set of vertices of GD corresponding to faces of G2 incident to vertex v, to the set of vertices corresponding to faces incident to vertex w. Procedure ADD-CROSSINGS is heuristic and does not guarantee the minimum. It gives good results in all cases in which the set of irreducible edges is of small size. This is usual in entity relationship diagrams for real life applications. Referring to the example (Figure 16), the planar representation a) is chosen by the algorithm. Step 3: Normalization. Step 3 transforms G2 into an orthogonal graph in which each face of C2 appears with the shape of a rectangled polygon. Each planar graph with degree 54, normalized graph in the following can be drawn in the plane in such a way that lines corresponding to edges are sequences of segments parallel to Cartesian axes. In this drawing
169
Computer Aided Layout the faces of the graph become rectangled polygons, i.e., polygons formed by isooriented rectangles, and vertices of the graph are mapped into a subset of the geometric vertices of the rectangled polygons. We call such a drawing of a planar graph rectangled representation. Two rectangled representations of the same graph are said to be shape-equivalent if their corresponding faces are shape-equivalent rectangled polygons. See in Figure 17 two shape-equivalent rectangled polygons. This equivalence relation induces a partition on the set of rectangled representations of a given graph into equivalence classes that in the following we shall denote as orthogonal graphs. As a consequence, each face of the orthogonal graph is represented as a circular binary string where each bit in the string represents an internal angle of the rectangled polygon (bit = 0 if angle is 90 degrees, bit = 1 if the angle is 270 degrees). The binary string that represents rectangled polygons in Figure 17 is 000100. In order to build an orthogonal graph corresponding to the planar graph G2 it is necessary to perform a normalization step in which a normalized graph GN is ob tained from G2 by splitting nodes with degree > 4 into cycles of new nodes. The problem of transforming the normalized planar graph GN into the orthogonal graph G3 that represent GN with the minimum number of bends in his lines may be expressed by means of a linear programming algorithm. A global description of Step 3 is shown in Figure 18. See in Figure 19 the orthogonal graph, corresponding to the planar graph of Figure 16(a), produced by Step 3. Procedure NORMALIZE is described in Figure 20. See in Figure 21 an example of transformation afforded by procedure NORMALIZE. With reference to the normalized graph GN =
Figure 19, The orthogonal graph for the example.
PROCEDURE NORMALIZE (GZ.GN); begin for each node n E V2 such that degree (n) > 4 da begin let S(n) be the set of edges incident to n; is(n) has an ifnpticitcircular ordering, due to the properties of the planar e&edding G2f transform n into a cycle c(n) of in new nodes, where n is the nun&r of grid cells of the boundary in the area in Table 1; assign seqwntially edges in S(n) according to the circular ordering end end;
Figure 20.
@_@
Figure 21. Transformation NORMALIZE.
afforded
by
procedure
(Vn,En) produced by procedure NORMALIZE, give the following definitions:
we
Fn is the set of faces of GN Fc is the subset of faces of GN contoured by cycles c(n) abovedefined Figure 17. Two shape equivalent rectangied polygons.
Vc is the subset of vertices belonging to faces of Fc EC is the subset of edges belonging to faces of Fc
Figure lg. Global description of Step 3.
1. N~R~LIZE
(G2,GN)
iGN is a nonaiized have degree <=4)
version of 62 in which ail nodes
2. ORTHOGONALIZE (GN,G3) 163 is the orthogonal graph corresponding to GN)
int(j) is a function En - Fn that maps each edge j to one of the two faces to which j belongs; each edge j is said to be internal to face in@) f(i) is the set of faces to which vertex i belongs Procedure ORTHOGONALIZE finds an orthogonal graph G3 corresponding to the normalized graph
C. Batini et al.
170 where
GN, solving the following linear integer programming problem:
ab,k] =
min z = cx Ax = b x>=o x integer
+I,
if k = int(j) otherwise
This means that since nc and nv are the number of internal concave and convex angles: nv - nc = 4
where variables may be: vertex variables w[i,k], that represents the measure of the angle a of face k E f(i) incident to vertex i:
The total number of variables that are not determined by Eq. (3b) is:
w[i,k] := 2a/r - 1
4. (IEn
(1)
-
(EC]).
the number of vertex variables is:
The total number of equations is:
c
lVn] + ]Fn] - ]Vc] - IFcl - 1,
If(i)] = 2 * ]E].
iGVU
or, applying Euler’s formula to the planar graph GN: Edge variables xb], y Q] represent the number of convex angles and the number of concave angles lying on edge j and internal to face int(j); the number of edge variables is 2 * 1E I. The objective function represents the total number of bends in the lines of orthogonal graph G3: z: = x (xlj] + ylil). $EEn
JEnl -
IFcJ + 1.
The above problem is an integer PL problem. It may be shown that it is an intrinsically integer problem too
11% When attributes are taken into account for each entity the algorithm checks, the number of vertical segments in the cycle is greater or equal to n/k, where n is the number of attributes of the entity and k is the standard maximum number of attributes that can be placed in each cell. In this case, further nodes are added to the cycle.
(2)
Ax = b is the following set of conditions:
&I (wIi,kl + 1) = 4
IVcl -
@a)
for each i E Vn - Vc there is a constraint of this type; for each cycle k E Fc for each corner vertex i of cycle k; for each vertex i of cycle k that is not a corner vertex; for each edge j of cycle k.
w[i,k] = 0 w[i,k] = 1 XL] = ylj] = 0
Step 4: Compaction Step 4 transforms G3 in a new graph G4, called grid-graph. G4 has the same shape of G3: a dimension is associated in G4 to each segment in G3 that minimizes, for that shape, the global length of segments in rectangled polygons of G3. Such dimensions are integer numbers, multiples of the dimension of a cell of the grid that will contain at the end of the process the ER diagram. See in Figure 23 the grid graph corresponding to the orthogonal graph in Figure 19. A global description of Step 4 is shown in Figure 24. Procedure FIND-LENGTHS finds the grid graph corresponding to G3, with minimal global length of seg-
(3b)
These conditions express the property that cycles of G3 related to entities with degree L 4 are mapped into rectangles with appropriate corner vertices (see Figure 22, where 1234 is a cycle of this type). For each internal face k E Fn - Fc - {external face}:
6 B
7
I”
11
5
1
2
4
3
’ 9 8
9
Figure 22. Mapping cycles related to entities in rectangles: cycle 1234 is related to an entity with degree = 7.
171
Computer Aided Layout __:_____1_____:_
_I_-____;___--I t
t
I
I
t
I
I
I
D f I I I i------:---_---~-t---'~--1-----I 8 I I _ 1 _ i I F I I s ' c I ~~_~_~___~~______~__~~~~~_
,
8 t , ______'_______' , I I I -. I -A____--;__-_-_;--_ I 8 I t I , I I -+_~.-----,---_-:
I
I I
---:_-----;--__--c-
I
I _‘-_----;-__--_
:
, I I f t :______;______+_--__-i___-__~f_ I # _ 1 -,G ' B I I I
A,.! !
I
-;--_---~___--_:--~__--l-------L__~.__-,--____ , f I I I I I , / t t / t I I f -~---_-_+-__--..:__----+------f__-_--~___-_-L. , I I
f I
:
I I / I
I f
f
:
I I
;
:_ I I 1 1
Figure 23. The grid graph for the example.
ments, solving the problem:
following
linear
programming
imposed to the lengths of the sides of a polygon in order to guarantee that it is not intersected (see in Figure 25 examples of intersected and not intersected polygons with the same shape). For instance, given any polygon with the shape of Figure 25, the constraint is length(BC) < length(ED). (5) 1 is an array where 2 when the corresponding segment connects two l(i) = :’entities; [ 1 otherwise. Value 2 is necessary in order to make space for relationships. When attributes are taken into account, further conditions are imposed in order to make space for attribute names. Step Sk Drawing Step 5 transforms G4 in the final ER diagram. Four types of objects may appear in the cells of the grid containing the diagram: entities, relationships, connections, crossings.
min cx, Ax = b, Dx <= f, x>= 1, x integer,
1. Entities with degree > 4 are placed in areas toured by cycles c(n) introduced in Step 3 (see ure 26). 2. Relationships with degree = 2 are placed in that lie in intermediate position along lines that nect corresponding entities,
where (1) variables are:
x[il, icX Yti19 jcy representing lengths vertical. (2) min cx is
of segments
horizontal
conFig cells con-
and rL_
min x x[i] + ;Tz:yb]. *ix
A
F
1EY
I_
(3) Ax = b is:
z
G
SG(i,k) . x(i) = 0; itG
c
SW_i,k)
. y(j)
=
H
0,
jtlk
Figure
for each rectangled polygon k of G3. (4) Dx I f express the constraint that must be super-
H
Figure 24. {X.V are a partition of segments belonging to rectangled polygons of G3, according to their orientation (horizontal (X) or vertical (V)) iSG(s.k) is a function that partitions segments of rectangled polygon into two classes according to the direction they are traversed when the corresponding polygon is clockwise covered. Given any refer ence axes parallel to segments of 63, sign + will be associated to a segment s of a ratangled polygon k if it is traversed in the same direction of axes, sign othewise) 2. FINO-LENGHTS (G3,X,V,SG(s,k),G4) (64
is the grid-graph car~esponding to 63)
C
25. Examples of intersected and nonintersected
polygons,
Figure 26. Examples of entity generation,
1. IDENTIFY-SEGMENTS (G3.X.V.SG)
6
D
C. Batini et al.
172
3. Entities with degree < = 4, relationships with degree > 2, connections and crossings are placed in the cells assigned in step 4. For our example, at the end of the layout process the diagram in Figure 27 is produced. THE RESTRUCTURING TOOL
.
I
Figure 28. The WINDOW command.
A restructuring is a design activity whose goal is to change the schema. Such change involves, in general: 1. the deletion of a subschema S 1. 2. the adding of a new subschema S2. Notice that optionally either Sl or S2 can be void. In GINCOD two different types of restructurings can occur, according to the type of interaction between the designer and the system. In user-driven interactions it is responsibility of the user to build the layout of the new schema S2 and the embedding of S2 in the old schema. In system-driven interactions all the layout activity is the responsibility of the system. During user-driven interactions several editing commands can be used by the designer in order to place new symbols and connections. In particular, if the deleted subschema Sl is composed of a unique object (we call context free this type of restructu~ng), the designer can make place for the new structure by means of a WINDOW command that shifts any of the four halfplanes that lie on the east, north, west, or south side of the cell(s) that contain(s) the object. In such a way the designer creates a window in which to place the new structure (see an example in Figure 28, where shifts have been applied in north and west directions). The goal of the restructuring algorithm is to produce a new diagram that approaches as far as possible aesthetic criteria of the third section. Figure 27. The final ER diagram for the example.
The algorithm, taking into account the type of interaction chosen by the designer, uses different heuristics in order to make profit of the general strategy of the layout algorithm of the fourth section, without redoing the whole job. In the case of user-driven interactions the layout algorithm is initially reused starting from step 3. Notice that starting from step 4, in general, is of no use. With regard to context-free interactions, the WINDOW command creates strips (see Figure 29) that outside the window contain only connections. Such wasted space can be reduced only by modifying the shape of the orthogonal representation underlying the diagram. The same happens more critically for noncontext-free interactions that modify in general the whole diagram. When step 3 is executed the designer is requested to judge the quality of the layout; in this case, he can op tionally activate newly the layout algorithm starting from step 2. System-driven interactions are useful every time the designer finds it difficult or frustrating to modify the diagram by himself. In such a situation the tool directly restarts the layout algorithm from the planarization step.
CONCLUSIONS AND FURTHER RESEARCH
The algorithm we have presented in this paper is presently under implementation on a PDPl l/23 PLUS computer, RSXl 1 Operating System, and PASCAL language. The prototype will be used in a real life environment in order to improve the analysis of the overall algorithm. We think that the major improvement will be the p~sibility for the designer to interact with the tool Figure 29. Strips created by WINDOW
command.
173
Computer Aided Layout in order to simplify its task. We are currently looking for the best procedurality for such interaction. A good solution is to obtain from the tool, first of all, a first draft ER diagram built with low effort. The designer examines the diagram and supports the tool with new aesthetic information. The tool is now able to supply more sophisticated strategies on a simplified task. It is a critical issue to select information that is both friendly for the designer and useful for the tool. A second improvement will be the introduction in diagrams of generalization hierarchies. Generalization hierarchies impose further aesthetic criteria, e.g., the verticality of the hierarchy and the symmetry of involved entities with respect to an axis.
REFERENCES
P. Atzeni, C. Batini, V. De Antonellis, M. Lenzerini, F. Villanelli, and B. Zonta, A computer aided tool for conceptual data base design, in Proc. IFIP Conf. on Automated Tools for Information Systems Design and De-
North Holland, New York, 1982. P. Atzeni, C. Batini, M. Lenzerini, F. Villanelli, and D. T. Incod, A system for conceptual design of data and transactions in the Entity Relationship model, in Proc. velopment,
of the 2nd Conf. on the Entity Relationship Approach, E. R. Institute, 198 1.
C. Batini, and C. Costa, A graphical tool for conceptual design of data base applications, in 20th ACM IEEE Conference on Design Automation, Miami, 1983.
4. C. Batini and M. Lenzerini,
A meth~ology for data in the Entity Relationship model; IEEE Transactions on Software Engineering, to appear. 5. C. Batini, M. Lenzerini, and M. Moscarini, Views integration, in ~ethodolo~ and Tools for Data Base Design, (S. Ceri, ed.), North Holland, New York, 1983. 6. P. Chen, The Entity Relationship Model: Toward a Unified View of Data, ACM Trans. on Data Base Systems 1 (1976). 7. T. Chiba, I. Nishioka, and I. Shirakawa, An Algorithm of Maximal Planarization of Graphs, in Proc. ISCAS (1979). 8. S. Even, Graph Algorithms Pitman, 1979. 9. M. R. Garey and D. S. Johnson, Computers and lntractability, Freeman, 1979. 10. D. S. Johnson, The NP-Completeness Column: An Ongoing Guide, J. Algorithms 3 (1982). 11. F. Harary, Graph Theory, Addison-Wesley, 1969. 12. R. S. Ligget and W. J. Mitchell, Interactive Graphic Floor Plan Layout Method, CAD 13 (1981). 13. V. W. Lum et al., New Orleans data base design working report, in Proc. of the 5th Int. Conf on Very Large Data Bases, Rio de Janeiro (1979). 14. A. R. Newton, Computer Aided Design of VLSI Circuits, Proc. IEEE 69 (198 1). 15. A. Paoluzzi, 11progetto di componenti edilizi industriaiizzati ed il controllo di qua&a attraverso I’approccio sistemistico, Technical Report p. 14 Istituto di architettura ediliziae tecnica urbanistica, Universita di Roma (1978). 16. J. Soukup, Circuit Layout, Proc. IEEE 69 (1981). 17. J. Seppanen and J. M. Moore, Facilities Planning with Graph Theory, Management Science 17 (1970). schema integration