how to draw a hypergraph

10
This article was downloaded by: [North Carolina State University] On: 19 May 2013, At: 01:29 Publisher: Taylor & Francis Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House, 37-41 Mortimer Street, London W1T 3JH, UK International Journal of Computer Mathematics Publication details, including instructions for authors and subscription information: http://www.tandfonline.com/loi/gcom20 How to draw a hypergraph Erkki Mäkinen a a Department of Computer Science, University of Tampere, P. O Box 607, Tampere, SF-33101, Finland Published online: 19 Mar 2007. To cite this article: Erkki Mäkinen (1990): How to draw a hypergraph, International Journal of Computer Mathematics, 34:3-4, 177-185 To link to this article: http://dx.doi.org/10.1080/00207169008803875 PLEASE SCROLL DOWN FOR ARTICLE Full terms and conditions of use: http://www.tandfonline.com/page/terms-and-conditions This article may be used for research, teaching, and private study purposes. Any substantial or systematic reproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in any form to anyone is expressly forbidden. The publisher does not give any warranty express or implied or make any representation that the contents will be complete or accurate or up to date. The accuracy of any instructions, formulae, and drug doses should be independently verified with primary sources. The publisher shall not be liable for any loss, actions, claims, proceedings, demand, or costs or damages whatsoever or howsoever caused arising directly or indirectly in connection with or arising out of the use of this material.

Upload: erkki

Post on 11-Dec-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to draw a hypergraph

This article was downloaded by: [North Carolina State University]On: 19 May 2013, At: 01:29Publisher: Taylor & FrancisInforma Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House, 37-41 Mortimer Street,London W1T 3JH, UK

International Journal of Computer MathematicsPublication details, including instructions for authors and subscription information:http://www.tandfonline.com/loi/gcom20

How to draw a hypergraphErkki Mäkinen aa Department of Computer Science, University of Tampere, P. O Box 607, Tampere, SF-33101, FinlandPublished online: 19 Mar 2007.

To cite this article: Erkki Mäkinen (1990): How to draw a hypergraph, International Journal of Computer Mathematics, 34:3-4, 177-185

To link to this article: http://dx.doi.org/10.1080/00207169008803875

PLEASE SCROLL DOWN FOR ARTICLE

Full terms and conditions of use: http://www.tandfonline.com/page/terms-and-conditions

This article may be used for research, teaching, and private study purposes. Any substantial or systematic reproduction, redistribution,reselling, loan, sub-licensing, systematic supply, or distribution in any form to anyone is expressly forbidden.

The publisher does not give any warranty express or implied or make any representation that the contents will be complete or accurateor up to date. The accuracy of any instructions, formulae, and drug doses should be independently verified with primary sources. Thepublisher shall not be liable for any loss, actions, claims, proceedings, demand, or costs or damages whatsoever or howsoever causedarising directly or indirectly in connection with or arising out of the use of this material.

Page 2: How to draw a hypergraph

Intern. J. Computer Math.. Vol 34. pp. 177-185 Reprims available direcrly from the publisher Photocopymg permitred by l~cense only

(' 1990 Gordon and Breach. Science Publ~shers. Inc. Printed In the United Kmgdom

HOW TO DRAW A HYPERGRAPH

ERKKI MAKINEN

University of Tampere, Department of Computer Science, P . 0 Box 607, SF-33101 Tampere, Finland

(Recbeicw/ 17 Nouember 1989; injinuljbrm 17 January 1990)

There is an increasing amount of applications in computer science and other fields in which hypergraphs are used. This paper shows that in many cases the problem of drawing a hypergraph can be reduced to the problem of drawing normal graphs. This holds true especially when considering hypergraphs drawing in the edge standard, i.e. when the hyperedges connecting the vertices are drawn as curves.

KEY WORDS: Hypergraph. subset standard. edge standard. Venn diagram, Zykov planarity, one- sided bunch problem. hierarchical graph, hierarchical hypergraph

C.R. CATEGORIES: E.O. E.I . G.2.2

1. INTRODUCTION

There is a huge literature on algorithms for producing aesthetically pleasing drawings of graphs, see e.g. [8]. The vague expression "aesthetically pleasing" can be replaced by exact measures concerning the number of edge-crossings, the number of bends in edges, the area needed, the degree of symmetry, and so on. The existing algorithms use one or a few of these measures and try to optimize the drawing with respect to the criterion or criteria selected. The drawing problem is completely solved only for some special cases of graphs, and most algorithmic problems related to graph drawings are NP-complete or even more difficult [4].

Also hypergraphs have various applications in which pleasing layouts are most desirable. For example, in the theory of relational databases there is a natural correspondence between database schemes and hypergraphs. A database scheme consists of a set of relation schemes, each of which being a collection of attributes. If database schemes correspond to hypergraphs then relation schemes correspond to hyperedges and attributes correspond to vertices [9]. Drawings of database schemes as hyperedges are used especially when studying their cyclicity. Other computer science applications in which hypergraphs are used include e.g. func- tional dependency in database schemes, and-or graphs in problem solving, Horn clauses in logic programming [I], and specification of concurrent systems [13].

The present paper studies drawings for hypergraphs. There are two distinct widely used methods for describing a hypergraph. One method stresses the fact that a hypergraph is a collection of subsets of a given set (see Figure la) and in the other one we actually connect the vertices belonging to the same hyperedge (see Figure lb). These basic methods are called the subset standard and the edge

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013

Page 3: How to draw a hypergraph

E. MAKINEN

Figure l a .4 hqpergraph in the subset stanciard

Figure l b A hqpergraph in the edge standard

statzdarrl. respectively. The set of curves representing the connections of a hyperedge in the edge standard is called a hnnclz. Figure i b has three bunches connecting the vertices in the edges jri, f ) , ja,b,c}, and {c .d ,e ) . As the two drawing standards are quite different in character, the aesthetics related to them are different. too. These aesthetics are discussed in Sections 2-4.

The subset standard resembles the concept of Venn diagrams, a widely used formalism for set-theoretic relations. Various algorithmic problems related to the subset standard are studied in [14]. Some of this material is related to hypergraph drawing and is surveyed in Section 2. The subset standard is often used when drawing database schemes as hypergraphs.

In Section 3 we introduce aesthetics for edge standard drawings of directed hypergraphs. It is shown that this problem is closely related to the normal graph drawing problem. Section 4 is devoted to drawings for undirected hypergraphs. These in turn are related to the drawings of hierarchical graphs. The correspond- ing drawing problem for hypergraphs can be formalized as follows: Order the vertices of a hypergraph to a row such that the number of edge crossings of the edge standard drawing is minimized. We study several variations of this theme.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013

Page 4: How to draw a hypergraph

HYPERGRAPH DRAWING 179

We assume a familiarity with graphs and their planarity as described e.g. in C121.

2. DRAWINGS OBEYING THE SUBSET STANDARD

Let X be a finite set of certices, and let E be a family of subsets of X . The subsets in E are called hyperedges, or simply edges if no confusion is possible. The couple H = ( X , E) is called a hypergraph [ 2 ] . It is usually supposed, although not relevant in the present d~scussion, that all edges in E are non-empty and each vertex in X belongs to at least one edge.

Given a hypergraph H = ( X , E) we define a binary equivalence relation r in X as follows. The relation r holds for a pair y and z of vertices if and only if for each edge e in E, v c e if and only if zEe . The condensation of H is the hypergraph H f = ( X ' , E') in which X' contains a vertex for each equivalence class of X with respect to r and E' has an edge e' with a vertex x' if the correspondmg edge e in E has a vertex x belonging to the equivalence class represented by u'.

We start by considering aesthetics for the subset standard and survey some results from [I4]. Given a hypergraph H = ( K E,) a (vertex-based) Vrnn diagram representation for H consist of a planar graph G, an embedding of G into the plane, and a one-to-one map from V to the set of faces in the embedding, such that for each hyperedge e in E, the union of the faces corresponding to the vertices in e comprises a region of the plane whose interior is connected [14]. Hence in a Venn diagram representation each face corresponds to a vertice of the hypergraph in question, and a set of vertices forming an edge must be adjacent.

When drawing a hypergraph H we can first find out the Venn diagram representation of the condensation of H . Then the vertices in each equivalence class are plotted to the face representing the equivalence class in question. For increasmg readability the rectangles bordering the faces should be replaced by rounded rectilinear shapes. Figure 2a shows a vertex-based Venn diagram representing the hypergraph of Figure la. The notation [x] stands for the equivalence class containing ,u. Note that all the classes except [dl contain only one vertex. Figure 2b shows the corresponding hypergraph drawing.

Johnson and Pollak have proved the following characterization: A hypergraph H = ( X , E) has a vertex-based Venn diagram representation if and only if there exists a planar graph G = ( X , F) such that for each hyperedge r in E, the subgraph induced by e is connected [14]. However, this characterization does not help us to find out a Venn diagram representing a given hypergraph. As a matter of fact, Johnson and Pollak have shown that there are hypergraphs for which such a representation does not exist, and that i t is a NP-complete problem to test whether or not a given hypergraph has a Venn diagram representation [14].

In a somewhat similar context Harel [I31 follows the convention that a face in the drawing is identifiable only if it is denoted by a "b lob of its own. Hence, in this convention one can identify whether or not a face in the drawing contains vertices or simply unintentionally results from the drawing method used. In our notation this convention would be confusing.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013

Page 5: How to draw a hypergraph

Figure 2a A Venn diagram representing the condensation of the hypergraph of Figure l a

Figure 2b A hypergraph drawing obtained from Figure 2a.

We are not able to give a general drawing method for the subset standard. We end this section by listing some desirable properties for such drawings. It would be nice if the contours had a fixed shape, e.g. the rounded rectilinear shape used in Figure la. The figures representing the subsets should be isomorphic and their sizes should be proportional to the number of vertices belonging to them. The number of contour crossings should be as small as possible.

3. DRAWINGS FOR DIRECTED HYPERGRAPHS IN THE EDGE STANDARD

Consider now the edge standard. As hypergraphs are generalized graphs and the edge standard resembles the way in which graphs are usually drawn, one cannot expect efficient general-purpose algorithms producing optimal layouts with respect to any of the commonly used aesthetics.

The version of the edge standard shown in Figure l b is especially suitable for directed hypergraphs. In a directed hypergraph each edge has a unique target vertex; the other vertices are source vertices. Figure l b is drawn as if a were the target of { a , b , c ) and c the target of { c , d , e ) . Thus, directed hypergraphs are drawn so that the curves of a bunch are joined on their way from the sources to the target. Applications employing directed hypergraphs are surveyed in [I].

When drawing graphs the most important and the most thoroughly considered concept is the one of planarity. We have already considered a concept related to hypergraph planarity, namely that of Venn diagram representation. We next consider the planarity of hypergraphs from the point of view of the edge standard drawings. If H = ( X , E) is a hypergraph, we define its underlying graph G H = ( Z , F ) as follows. To the set of vertices Y we take all the vertices of H and a vertex for

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013

Page 6: How to draw a hypergraph

HYPERGRAPH DRAWING 18 1

each hyperedge in E, i.e. we have Z = X u I: where Y = {j , le E E } . The set of edges F consists of pairs (x,).) where x is a vertex in X and J is a vertex in Y representing the hyperedge to which x belongs. We say that a hyperedge H is plunnr if and only if its underlying graph G, is planar. This concept of planarity is referred to as Zykor p i ~ n o r i t y in [14], see also [21]. Note how Zykov planarity is naturally derived from an edge standard drawing by adding a vertex to each edge to the point where the curves from the sources to the target are joined.

For example. consider a hypergraph H containing three edges which have three vertices in common. The underlying graph of H has the complete bipartite graph K, , , as its subgraph and thus, H is not Zykov planar. This example shows that the class of Zykov planar hypergraphs is rather restricted. However, it contains most of the hypergraphs which are of interest in database theory. It is advan- tageous to choose database schemes in such a way that the hypergraph corres- ponding to them are acyclic [9]. Fortunately. it is known [21] that if a hypergraph H does not have a cycle (a Berge cycle in the terminology used in [9] ) of length greater than two, then H is Zykov planar.

A planar embedding for a planar hypergraph can be produced by embedding the underlying graph and by omitting all the vertices in Y. Hence, we can reduce the drawing problem for planar directed hypergraphs to the drawing problem for planar graphs. There are special algorithms for embedding planar graphs; see [3,5,10] and the references given there. Similarly, nonplanar hypergraphs can be drawn by algorithms constructed for general (nonplanar) graphs. In that case natural aesthetics, such as minimizing the number of edge crossings [ll], are NP-complete.

If a hypergraph is Zykov planar then there is a Venn diagram representing it, but not necessarily vice versa [14]. Thus, Zykov planarity is a strictly less general property than Venn diagram representation.

The problem of drawing an arbitrary directed hypergraph is open in the general case as is the corresponding problem for graphs. Although the two drawing problems are quite similar there are some special features to notice when drawing directed hypergraphs; we mention one of them.

For each edge e with at least three vertices in a drawing of a hypergraph, let R(e) denote the simple polygon obtained by connecting the vertices. It is now natural to require that the curves from the sources to the target are joined inside R(e). This means that in the embedding of the underlying graph, the additional vertex j , in Y must lie in R(r). Figure 3 shows a layout of the four vertices of an edge. The point in which the curves are joined should be inside the shadowed area.

We have neglected the case of hyperedges containing only one vertex. Such edges can be drawn e.g. as loops.

4. DRAWINGS FOR UNDIRECTED HYPERGRAPHS IN THE EDGE STANDARD

This section is devoted to aesthetics for undirected hypergraphs. Now all the vertices of an edge must be treated alike. This means that we do not join the

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013

Page 7: How to draw a hypergraph

Figure 3 A lajout of the four vertices of a n edge with the area in which the curves bhould be joined.

curves as they enter to one of the vertices in an edge. Moreover, we simplify the problem by considering only drawings in which the vertices are embedded to certain fixed positions, usually to a line. Among such embeddings it is natural to prefer drawings with minimum number of edge crossings.

Our basic layout variant is the following: Order the vertices of an undirected hypergraph to a horizontal line and the bunches to another horizontal line so that each vertex and bunch is located separately. Figure 4a shows one such layout for the hypergraph of Figure l b (excluding the direction of the edges). Note that the curves in the bunches are not joined as in Figure I b since none of the vertices is in special position. By reordering both the vertices and the bunches we obtain a layout with no crossings (see Figure 4b). The problem of minimizing the number of crossings in the above setting is referred to as the one-sided bunch problem ( IBP) . IBP is known to be NP-complete [ I l l . The problem remains NP-complete even if we fix the order in one of the lines [ 7 ] The problem of ordering one of the lines is referred to as the left optitnal drurving problem in [7], but f B P is more appropriate for us.

The known heuristics for 1BP and its variants are based on heuristics for fBP . Namely. if we have a heuristic for iBP, we can alternatively apply it to the two lines in a given instance of 1BP and expect that the repeated orderings converge to a solution for IBP. Several good heuristics for i B P are introduced in the literature C6, 151.

Variants of 1BP can be defined by changing the place of vertices or bunches. We start by allowing bunches to be drawn to either side (below or above) of the row of vertices. Hence, the nco-sided bunch problem (2BP) differs from IBP so that we must first divide the bunches into two subsets and then draw the resulting 3- layered hierarchical graph 1191 with as few crossings as possible.

We can further generalize our basic theme towards the concept of hierarchical graph. A hypergraph H = ( X , E) is said to be an n-lecel hierurchicul hj'pergruph if there is a partition X = X , u X , u ~ . . u X , such that each edge of E is contained in X, v X i + , for some I 5 i 5 t~ - 1. An n-level hierarchical hypergraph can be drawn

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013

Page 8: How to draw a hypergraph

H Y P E R G R A P H D R A W I N G

Figure 4a A layout of the hypergraph in F ~ g u r e Ib.

Figure 4b A layout of t h e hypergraph in Figure l b with n o crossings.

by embedding the vertices to n horizontal lines and by drawing the bunches between the lines. A bunch may be connected to the lines both above and below it.

Drawing an n-level hierarchical hypergraph equals the problem of drawing a (2n+ I)-level hierarchical graph [I91 with the exception that there is no obvious way to form the hierarchy. Algorithms for the drawing problem concerning n-level hierarchical graphs are studied in [16, 17, 19,201.

Note that each hypergraph H = ( X , E) is a 2-level hierarchical hypergraph, even for all partitions of X. The problem is to find a partition X = X , u X , such that there are sufficient number of edges e for which we have EX, or P E X , . The bunches corresponding to these edges can be drawn below or above the two lines of edges leaving the middle for edges having vertices both in X I and X,. Figure 5 shows such a drawing for a hypergraph with E = ( ( a , b , ~ ) , { ~ ~ ) , { a , b . d ) , ( b , c . e , j ) , [ d , e ) , { e , f))..

Since all hypergraphs are 2-level hierarchical hypergraphs, they are n-level hierarchical hypergraphs for each n, n z 2 , but not for all partitions. As the problem of finding a suitable partition for an arbitrary hypergraph and for an arbitrary n becomes more difficult when n increases. it is better to restrict oneself to small values of n.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013

Page 9: How to draw a hypergraph

Figure 5 A drawing for a 2-level hierarchical hypergraph

5. CONCLUDING REMARKS

We have been able to show that the problem of drawing a hypergraph in the edge standard can be reduced to the problem of drawing a graph. Although the latter problem is computationally hard and not well understood in the general case, there are good heuristics for several practical subcases. Better algorithms for drawing a hypergraph in the edge standard can be obtained only by developing better algorithms for drawing normal graphs.

There are no well studied problems to which the problem of drawing a hypergraph in the subset standard could be naturally reduced. Hence. we lack for heuristics that produce reasonable layouts. On the other hand, we can easily list aesthetics for such layouts as is done in the end of Section 2. So, in case of this problem our present capabilities and needs are much more apart that in the case of the edge standard drawings.

The form of the edge standard drawings we have suggested for directed hypergraphs coincide the practice generally followed in the literature. Hence, our contribution here is that we have completely reduced the problem to the normal graph drawing problem. In the case of undirected hypergraphs we have to simplify the problem in order to be able to reduce it to well studied graph drawing problems. The simplification is made by restricting the layout of vertices. As the vertices in undirected hypergraphs must be treated alike, we argue that this simplification clarifies the drawings obtained. The automatization of nice drawings

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013

Page 10: How to draw a hypergraph

HYPERGRAPH DRAWING 185

in the subset standard seems to be more difficult than in the edge standard. The method based on Venn diagram representations produces pleasing drawings but i t is not applicable for all hypergraphs.

[ I ] G. A u d l o , Directed hypergraphs: data structures and applications. In: Proc,. CAAP'88, Lecture Notes 111 Computer Scirwc,e 299 (1988), 295 303.

L2] C . Berge, Gruphs and Ilyprr~ruphs, North-Holland, Amsterdam, 1973. [3] B. Becker and H. G. Osthof. Layouts with wlres of balanced length. In/: Comput. 73 (1987). 45-58. [4] F. J. Brandenburg, Nice drawings of graphs and trees are computationally hard. Fakultat fiir

Mathematlk und Informatik, Universitiit Passau. Passau, Report MIP-8820, September 1988. [SJ N. Chiba. K. Onoguchi and T. Nishizeki, Drawing planar graphs nicely, Actu Infbrvl. 22 (1985).

153-1 73. [6] P. Eades and D. Kelly. Heuristics for reducing crossings in 2-layered networks. Ars C'omhincrroria

2IA (1986), 1986. L7] P. Eades and B. McKay, An NP-complete crossing number problem for bipartite graphs. Dept. of

Computer Science, University of Queensland, St. Lucia. Tech. Report No. 60, April 1985. LX] P. Eades and R. Tamassla, Algorithms for automatic graph drawing: an annotated bibliography.

Dept. of Computer Science, Brown IJniversity, Providence, RI, Tech. Report CS-89-09, 1989. [9] R. Fagin, Degrees of acyclicity for hypergraphs and relational database schemes, J. ACM 30

(1983), 514-550. 1101 H. de Fraysseix. J. Pach and R. Pollack, Small sets supporting Fary embeddings of planar graphs.

Proc. Twentieth Annual ACM Symposium on Theory of Computing, 42&433. 1988. 11 11 M. R. Garey and D. S. Johnson, Crossing number is NP-complete. SIAM J. Al~chraic. Discr~te

Mrrhor1.s 4 (1983). 312- 316. [I21 F. Harary, Graph 7'heory. Addison-Wesley, Reading. MA, 1969. [I31 D. Harel, On visual formalisms. Comm. AC'M 31 (1988). 5 1 4 530. 1141 D. S. Johnson and H. 0. Pollak. Hypergraph planarity and the complexity of drawing Venn

diagrams, .I. Graph Throrjx I0 (1987). 309-325. [IS] E. Mikinen, Experiments on drawing 2-level hierarchical graphs. Dept. of Computer Science,

University of Tampere. Tampere. Report A-1988-1. January 1988. 1161 F.. B. Messinger, Automatic layout of large directed graphs. Dept. of Computer Science,

University of Washington, Seattle, Tech. Report 88-07-08, June 1988. 1171 L. A. Rowe, M. Davis, E. Messinger, C. Meyer, C. Spirakis and A. Tuan, A browser for directed

graphs. Soit. Prr1c.t. L ~ p e r . 17 ( 1987). 61-76. [I81 J. A. Storer. On minimal-node-cost planar embeddings, Networks 14 (1984), 181 -212. 1191 K. Sugiyama, S. Tagawa and M. Toda, Methods for visual understanding of hierarchical system

structures, IEEE Trcms. S p t Mun Cvhrrn. SMC-It ( 1981), 109-125. [20] H. Trikey, DRAG: A graph drawing system, In: J. C. van Vlient (ed.), Documentation

Munipulu~ion und Typogrciphy. Cambridge University Press, Cambridge, 1988, pp. 17 1 -1 82. [21] T. R. S. Walsh, Hypermaps versus bipartite maps, J. Comhinuloriu/ Theory B 18 (1975). 155-163.

Dow

nloa

ded

by [

Nor

th C

arol

ina

Stat

e U

nive

rsity

] at

01:

29 1

9 M

ay 2

013