Next Article in Journal
Generalized Type-2 Fuzzy Control for Type-I Diabetes: Analytical Robust System
Next Article in Special Issue
A Game Theoretic Model of Struggle with Corruption in Auctions: Computer Simulation
Previous Article in Journal
JMA: Nature-Inspired Java Macaque Algorithm for Optimization Problem
Previous Article in Special Issue
An Analysis and Comparison of Multi-Factor Asset Pricing Model Performance during Pandemic Situations in Developed and Emerging Markets
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Mixed-Integer Program for Drawing Orthogonal Hyperedges in a Hierarchical Hypergraph

1
Department of Applied Mathematics and Mathematical Methods in Economics, Saint Petersburg State University of Economics, Griboedov Canal Emb., 30-32, 191023 St. Petersburg, Russia
2
Department of Applied Mathematics and Mathematical Modeling, Saint Petersburg State Marine Technical University, Lotsmanskaya Ulitsa, 3, 190121 St. Petersburg, Russia
*
Author to whom correspondence should be addressed.
Mathematics 2022, 10(5), 689; https://doi.org/10.3390/math10050689
Submission received: 20 December 2021 / Revised: 19 February 2022 / Accepted: 21 February 2022 / Published: 23 February 2022
(This article belongs to the Special Issue Mathematics and Financial Economics)

Abstract

:
This paper presents a new formulation and solution of a mixed-integer program for the hierarchical orthogonal hypergraph drawing problem, and the number of hyperedge crossings is minimized. The novel feature of the model is in combining several stages of the Sugiyama framework for graph drawing: vertex ordering, the assignment of vertices’ x-coordinates, and orthogonal hyperedge routing. The hyperedges of a hypergraph are assumed to be multi-source and multi-target, and vertices are depicted as rectangles with ports on their top and bottom sides. Such hypergraphs are used in data-flow diagrams and in a scheme of cooperation. The numerical results demonstrate the correctness and effectiveness of the proposed approach compared to mathematical heuristics. For instance, the proposed exact approach yields a 67.3 % reduction of the number of crossings compared to that obtained by using a mathematical heuristic for a dataset of non-planar graphs.

1. Introduction

A new optimization model for the layout problem of a hierarchical orthogonal hypergraph is discussed in this paper. The outputs of the model are node coordinates and hyperedge routing. The number of hyperedge crossings is minimized for better visibility in the graph layout, and some aesthetic metrics are optimized as well [1,2].
Every orthogonal hyperedge e is drawn with a set of upper vertical segments  s U ( e ) , a horizontal segment  s H ( e ) , and a set of lower vertical segments  s L ( e ) . It is assumed in this paper that all hyperedges are directed downwards. Each upper vertical segment of  s U ( e ) has the same length and starts in one of the ports of the source node; the number of ports and their coordinates are known for each node. The horizontal segment s H ( e ) is placed on the ordinate of the lower end of the vertical segments of s U ( e ) ; s H ( e ) and each vertical segment of s U ( e ) have one conjunction point. The vertical segments of s L ( e ) start on the s H ( e ) segment and arrive at one of the ports of their target nodes. Figure 1 shows an example of the layering of a hierarchical hypergraph with orthogonal hyperedges according to the described rules.
A well-known approach to hyperedge visualization is the replacement of each hyperedge with a set of edges with one dummy node, followed by the use of traditional layout techniques for graphs; then, the hypergraph is restored from the graph layout obtained in the previous step [3,4]. Therefore, this problem is closely related to hierarchical (i.e., directed acyclic) graph drawing, and methods based on the Sugiyama approach [5] will be applied.
To make this algorithm applicable to the hypergraph layout problem, Sander [6] first proposed reordering the nodes on each layer to minimize the number of edge crossings, and then calculated the preliminary coordinates for the nodes and segments to avoid hyperedge crossings, finally obtaining the coordinates that rendered a balanced drawing. In [7], an exact formulation of the mathematical problem of hyperedge routing was proposed, and it satisfied the constraints discussed above. The final step of the hypergraph drawing algorithm is assigning each upper vertical segment to a port of its source node and each lower vertical segment to a port of its target node.
Computing the optimal order of vertices for all layers of a graph is a highly time-consuming procedure. That is why it is reasonable to reorder vertices in each layer separately to minimize the number of edge crossings related to one of adjacent layers. A heuristic proposed in [8] was improved in further work; see [9].
Plenty of exact and heuristic algorithms have been presented for the minimization of edge crossings by reordering nodes on layers; see, e.g., [8,10]. However, application of these methods for a hypergraph might not provide acceptable results. It is known that decreasing the number of edge crossings does not ensure the same for the corresponding hypergraph [11]; see, for instance, Figure 2 and Figure 3, which present examples of single-source one-port hypergraphs.
An additional optimization problem arises if one takes ports for the source and target nodes into account because each vertical segment of a hyperedge must be assigned to a unique port. This problem should be considered as a part of a hierarchical hypergraph drawing problem, together with the reordering of nodes and horizontal segments. Figure 4 and Figure 5 show three layouts of the same hypergraph: without ports (optimal layout), with the assignment of ports as a result of a post-processing procedure, and, finally, with the optimal assignment of ports.
The reordering heuristic by Eschbach et al. [12] only gives a local minimum of the number of hyperedge crossings. Spönemann et al. [11] proposed an algorithm for quite accurate (but not exact) counting of hyperedge crossings depending on the order of nodes without computing the hyperedge routing.
A hyperedge drawing is applied in a variety of practical areas: from cooperation scheme drawing and information and financial flow visualization to schematics of displays of automotive communication networks and VLSI design. Interesting applications of the hypergraph layout problem can be found in the development of effective routing protocols for IoT applications and in the development of energy-balanced routing protocols for terrestrial/underwater wireless sensor networks, as well as in the assessment of their safety.
The information system for the national investment projects that started in Russia in 2015 is an example of graphical data analysis [7]. One of the goals of this information system is to control all financial transactions and contracts related to large-scale national projects, in which hundreds of companies are involved. The embedded software visualizes companies as nodes of a hierarchical hypergraph and their business links and financial transactions as directed hyperedges. This visualization scheme enables one to highlight potential risks and to estimate the status of a project under consideration. It is clear that this visualization is only helpful as an analytical tool if it is easy to understand. It is more to the point that the hypergraph density is high.
The neighboring area of application is financial flow visualization for corporations with large numbers of branch offices and commercial subsidiaries. The display of the flow of information within or between universities can be discussed as an application as well.
There are some novel approaches to nanostructures and material science with application of graph theory [13,14], where there is a large variety of applications connected with hierarchical hypergraphs with orthogonal hyperedges.

2. Requirements for Hyperedge Drawing

In mathematical terms, a directed k-layering hypergraph H = ( V , E H , λ ) contains a set V of nodes and a set E H of hyperedges. A hyperedge e = ( S , T ) has source nodes S V and target nodes T V . A layering function λ is introduced in order to partition the set of vertices V into a k finite subsets (layers) V 1 , V 2 , , V k . The function λ assigns a positive integer to each vertex v V (layer), 1 λ ( v ) k .
We assume the following set of requirements for orthogonal hyperedge routing, which is complementary to that for a layered graph drawing [10]:
  • Each hyperedge e consists of three elements: upper vertical segments s U ( e ) , horizontal segments s H ( e ) , and lower vertical segments s L ( e ) ;
  • Each hyperedge is incident to one or more source vertices and adjacent (target) vertices of the lower layers;
  • Vertices are represented by rectangles of a fixed size with a set of ports on their upper and lower sides. In fact, every port is a common point of a vertex and an incident hyperedge;
  • Each port of a vertex corresponds to exactly one vertical segment, either a segment of s U ( e ) or a segment of s L ( e ) . The number of ports of a vertex is equal to the number of incident hyperedges for this vertex;
  • For every two hyperedges e 1 and e 2 , it holds that e 1 and e 2 intersect if and only if a horizontal segment s H ( e 1 ) has crossing points with a vertical segment, a segment of s U ( e 2 ) , or a segment of s L ( e 2 ) , or vice versa. Note that this requirement means that the overlapping of segments becomes non-feasible for hypergraph drawing. Two examples of such non-feasible overlapping are demonstrated in Figure 6;
  • The number of hyperedge crossings is to be minimized.

3. Mathematical Model for Drawing a Hierarchical Hypergraph with Orthogonal Hyperedges and Ports

If hypergraph H contains hyperedges connecting the vertices of non-adjacent layers, then every such “long” hyperedge e has to be transformed into several hyperedges that connect the vertices of adjacent layers only, with additional (dummy) vertices being introduced for every e in the following way:
  • Find adjacent vertices u and v such that { u , v } = a r g m a x u S , v T λ ( u ) λ ( v ) ;
  • Insert a single dummy node on each layer l of hypergraph H, λ ( u ) < l < λ ( v ) ;
  • Replace the long hyperedge e with λ ( v ) λ ( u ) hyperedges that connect the inserted dummy vertices with the incident vertices of the original long hyperedge e so that each new hyperedge connects the vertices of the adjacent layers. This step should hold all of the connections between nodes on adjacent layers that are defined by hyperedge e.
Consider the hypergraph H = ( V , E H , λ ) , which is constructed from the hypergraph H (after inserting dummy vertices into it) by splitting each vertex into subsets of port vertices. For each vertex u V (so-called “generating vertex”), sets  K U and K L of the port vertices are introduced, K U ( u ) = { u U 1 , u U 2 , , u U m U } and K L ( u ) = { u L 1 , u L 2 , , u L m L } , where m U and m L denote the numbers of ports of vertex u for the upper vertical segments and for the lower vertical segments of the incident hyperedges, respectively. Each port vertex in the set K U ( u ) K L ( u ) is considered a vertex of hypergraph H . A function C is introduced as well. For each port vertex, the function C yields its generating vertex. Note that λ ( v ) = λ ( u ) v K U ( u ) K L ( u ) . Figure 7 demonstrates an example of such a transformation of hypergraph H into hypergraph  H .
The following specific constraints are to be taken into account for the drawing of hypergraph  H : port vertices with the same value for function C (those generated by one generating vertex) should be neighboring ones, i.e., between any two port vertices with the same value for function C, on every layer, there is no port vertex with another value for function C.
For the mathematical formulation of the hypergraph drawing problem, three sets of real variables are introduced—X, L M X , and  R M X —as well as four sets of integer variables— A C , H O , U C , and  L C .
Variable  X v denotes the x-coordinate of the vertex v V . The variables L M X e and R M X e are the x-coordinates of the leftmost and rightmost nodes of hyperedge e, respectively.
A minimum distance ρ ( u , v ) is known for each pair of port vertices u , v V : u , v K U ( C ( u ) ) (or u , v K L ( C ( u ) ) ), u v , or each pair of generating vertices u , v V : u v . The order relation u v for a pair of vertices u and v means that they are in lexicographic order on the same layer.
A maximum distance δ ( u , v ) is known between each pair of port vertices u , v K U ( u ) (or u , v K L ( u ) ) of a generating vertex u, u v .
A minimum distance θ ( e 1 , e 2 ) is known between vertical segments s U ( e 1 ) and s L ( e 2 ) or s L ( e 1 ) and s U ( e 2 ) for each pair of hyperedges e 1 , e 2 E H : e 1 e 2 . The order relation e 1 e 2 for a pair of hyperedges e 1 and e 2 means that they are in lexicographic order, and their source vertices are on the same layer.
Each hyperedge has a so-called “area of crossings”. This can be defined as a set of points with coordinates ( x , y ) such that x min v S T x ( v ) , max v S T x ( v ) and y is between the ordinates of the source and target nodes. Figure 8 demonstrates the area of crossings of hyperedge e 1 with the incident vertices ( 1 , 5 , 6 ) . Vertices 1 , 2 , 4 , 6 , which are incident to another hyperedge e 2 , are inside this region, and vertices 3 and 6 are outside of it.
For each pair of hyperedges ( e 1 , e 2 ) with source vertices on the same layers, where e 1 = ( S 1 , T 1 ) , e 2 = ( S 2 , T 2 ) and e 1 e 2 , the integer variables A C and H O and dummy variables U C and L C are introduced as follows:
A C e 1 , u = 0 , if u S 2 T 2 is outside the area of crossings of hyperedge e 1 , 1 , otherwise .
H O e 1 , e 2 = 0 , if the horizontal segment of e 2 is higher than that of e 1 , 1 , otherwise .
U C e 1 , e 2 = u S 2 A C e 1 , u , if the horizontal segment of e 1 is higher than that of e 2 , u S 1 A C e 2 , u , otherwise .
L C e 1 , e 2 = u T 1 A C e 2 , u , if the horizontal segment of e 1 is higher than that of e 2 , u T 2 A C e 1 , u , otherwise .
The variable U C e 1 , e 2 is the number of crossings between the horizontal segment of one hyperedge of a corresponding pair of hyperedges and the upper segments of the other hyperedge. Similarly, the variable L C e 1 , e 2 is the number of crossings between the horizontal segment of one hyperedge of this pair and the lower segments of the other hyperedge. The number of crossings for a pair of hyperedges  e 1 and  e 2 depends on the number of port vertices inside the area of crossings of these hyperedges and the relative vertical positions of their horizontal segments.
The following optimization criteria are applied in the model:
  • Reducing the number of hyperedge crossings;
  • Symmetric arrangement of source nodes relative to target nodes.
These can be formulated in the form:
min e 1 , e 2 E H : e 1 e 2 U C e 1 , e 2 + L C e 1 , e 2 ,
min e = ( S , T ) E H u S X u 1 | T | v T X v .
Note that, in all of the formulae below, | · | denotes the set cardinality for sets and an absolute value for numerical expressions.
The following set of constraints (7)–(10) is imposed for the generating and port vertices.
To ensure that no vertices overlap in the hypergraph layout, the distance between every pair of generating vertices u and v on the same layer ( u , v V : u v ) should be equal to or greater than  ρ ( u , v ) , i.e., | X u X v | ρ ( u , v ) . Taking into account that the abscissa of a generating vertex u can be calculated as the mean value of its port vertices with K U ( u ) abscissas, we re-write this condition in the form
1 | K U ( u ) | u K U ( u ) X u 1 | K U ( v ) | v K U ( v ) X v ρ ( u , v ) u , v V : u v .
Analogous conditions are to be imposed for the distance between each pair of port vertices u , v K U ( u ) (or u , v K L ( u ) ) of every generating vertex u V . Note that they set both the minimum and the maximum distance between  u and  v as follows:
ρ ( u , v ) | X u X v | δ ( u , v ) u V , u , v K U ( u ) or u , v K L ( u ) : u v .
The next set of conditions ensure that the mean value of the x-coordinates of the port vertices in the sets  K U ( u ) and  K L ( u ) are equal such that all of the port vertices in  K U ( u ) and  K L ( u ) are to be merged back into one generating vertex in the hypergraph drawing:
1 | K U ( u ) | u K U ( u ) X u = 1 | K L ( u ) | v K L ( u ) X v u V : K U ( u ) , K L ( u ) .
The obvious condition that every port vertex u incident to hyperedge e lies between the leftmost and the rightmost vertices incident to hyperedge e defines the following connection between variables X u , L M X e , and  R M X e for every hyperedge e:
L M X e X u R M X e e = ( S , T ) E H , u S T .
A set of constraints (11)–(17) is formulated for each pair of hyperedges e 1 = ( S 1 , T 1 ) , e 2 = ( S 2 , T 2 ) with source nodes on the same layer.
If the abscissa of a port vertex u incident to the hyperedge  e 2 belongs to the interval that is defined by the x-coordinates of the leftmost and the rightmost vertices incident to hyperedge  e 1 , then the vertex u is inside the area of crossings of hyperedge e 1 . In this case, there might be a crossing of a vertical segment of hyperedge  e 2 connected with the vertex u and a horizontal segment of hyperedge  e 1 . The fact that a vertex is inside the area of crossings for a pair of hyperedges depends on the abscissa of the vertex and the values of the variables  L M X e 1 and  R M X e 1 in the following manner:
R M X e 1 M × A C e 1 , u X u or X u L M X e 1 + M × A C e 1 , u e 1 = ( S 1 , T 1 ) , e 2 = ( S 2 , T 2 ) E H , u S 2 T 2 ,
Note that in expression (11) and in all of the formulae below, M is an arbitrary large positive number, M 1 .
The nonlinear conditions (3) and (4) are to be linearized in a standard manner as follows:
U C e 1 , e 2 u S 2 A C e 1 , u M × ( 1 H O e 1 , e 2 ) e 1 , e 2 E H : e 2 = ( S 2 , T 2 ) , e 1 e 2 .
L C e 1 , e 2 u T 1 A C e 2 , u M × ( 1 H O e 1 , e 2 ) e 1 , e 2 E H : e 1 = ( S 1 , T 1 ) , e 1 e 2 .
U C e 1 , e 2 u S 1 A C e 2 , u M × H O e 1 , e 2 e 1 , e 2 E H : e 1 = ( S 1 , T 1 ) , e 1 e 2 .
L C e 1 , e 2 u T 2 A C e 2 , u M × H O e 1 , e 2 e 1 , e 2 E H : e 2 = ( S 2 , T 2 ) , e 1 e 2 .
The vertical segments of every two hyperedges have no common point in the hypergraph layout. Hence, one has to ensure a minimum distance between the horizontal positions of the port vertices connected to these segments. The following conditions ensure the absence of non-feasible overlaps of hyperedge segments:
X u X v M × H O e 1 , e 2 + θ ( e 1 , e 2 ) e 1 = ( S 1 , T 1 ) , e 2 = ( S 2 , T 2 ) E H : e 1 e 2 u S 1 , v T 2 .
X u X v M × ( 1 H O e 1 , e 2 ) + θ ( e 1 , e 2 ) e 1 = ( S 1 , T 1 ) , e 2 = ( S 2 , T 2 ) E H : e 1 e 2 , u T 1 , v S 2 .
The transitivity condition is to be satisfied for the positions of the horizontal segments of any triplet of hyperedges:
0 H O e 1 , e 2 H O e 1 , e 3 + H O e 2 , e 3 1 e 1 , e 2 , e 3 E H : e 1 e 2 e 3 .
Finally, we determine the domains for all of the variables in the problem:
X u 0 u V and L M X e , R M X e R e E H .
H O e 1 , e 2 , U C e 1 , e 2 , L C e 1 , e 2 { 0 , 1 } e 1 , e 2 E H : e 1 e 2 .
A C e , u { 0 , 1 } e = S , T E H , u V : v S T , λ ( u ) = λ ( v ) .
The standard linearization procedure for nonlinear expressions (6)–(9), (11), (16), and (17) allows one to obtain a multi-objective mixed-integer program (5)–(21).
Figure 9 illustrates an example of the optimal layout of a hypergraph that was obtained on the basis of the model discussed above.
Two additional post-processing steps are required for an optimal hypergraph layout: first, all dummy vertices must be rendered as points, and second, all subsets of the port vertices corresponding to a generated vertex must be merged back into one vertex.

4. Minimizing the Height of the Hypergraph Drawing

The optimization model in (5)–(21) yields the relative order of the horizontal segments of the hyperedges. Clearly, some horizontal segments can be placed on the same horizontal level of the hypergraph layout without non-feasible overlapping. The smaller the number of horizontal levels where the horizontal segments are placed, the smaller the height of the hypergraph drawing will be.
Some modifications of the model in (5)–(21) are considered to minimize the number of horizontal levels for the horizontal segments of hyperedges.
First, two types of additional variables are introduced: real variables Y and binary variables  S H .
The variables S H e 1 , e 2 are defined for each pair of hyperedges e 1 = ( S 1 , T 1 ) and e 2 = ( S 2 , T 2 ) so that e 1 e 2 in the following way:
S H e 1 , e 2 = 0 , if the horizontal segments of e 1 and e 2 are on the same level , 1 , otherwise .
The variables Y e determine the relative level for the horizontal segment of every hyperedge e E H . The smaller the value of Y e is, the higher the horizontal segment of hyperedge e will be in the hypergraph drawing.
Second, condition (18) is replaced with the following system of constraints:
| Y e 1 Y e 2 | S H e 1 , e 2 e 1 , e 2 E H : e 1 e 2 .
S H e 1 , e 2 1 M u S 2 T 2 A C e 1 , u + v S 1 T 1 A C e 2 , v e 1 = ( S 1 , T 1 ) , e 2 = ( S 2 , T 2 ) E H : e 1 e 2 .
Conditions (23) and (24) are formulated for each pair of hyperedges e 1 and e 2 with source nodes on one layer, and they ensure that the values of Y e 1 and Y e 2 differ by a positive integer if the corresponding horizontal segments are on different levels. Again, a constant M 1 is used.
Finally, the following criterion is added to the optimization model in (5)–(21), (23), and (24):
min e E H Y e .
Figure 10 shows an example of the optimal layout of the hypergraph obtained using the described variant of the model. The horizontal segments of some hyperedges have the same ordinate, which makes it possible to reduce the height of the figure.

5. A Mathematical Heuristic for the Hypergraph Layout

The problem of the hypergraph layout in (5)–(21) can be solved using the following five-step mathematical heuristic:
  • Find the order of the vertices on each layer;
  • Assign preliminary abscissas to the vertices;
  • Find the relative order of horizontal segments for orthogonal hyperedges with source nodes on the same layer;
  • Remove the non-feasible overlapping of vertical segments;
  • Assign ports to the vertical segments.
Note that the aesthetic criteria used in the heuristic coincide with those in Section 3. The mathematical heuristic is sketched below; see Algorithm 1.
Algorithm 1: A mathematical heuristic for the hypergraph layout.
Data: hierarchical hypergraph H = ( V , E H , λ )
Result: hypergraph drawing D
o r d o r d e r i n g ( h y p e r g r a p h R e s t r u c t u r i n g 1 ( H ) ) ;
X a s s i g n i n g A b s c i s s a s ( h y p e r g r a p h R e s t r u c t u r i n g 2 ( H ) , o r d ) ;
H O h o r i z o n t a l S e g m e n t s O r d e r i n g ( H , X ) ;            /∗ ( (26)–(30) ( ∗/
X ˜ r e m o v e O v e r l a p p i n g ( H , X , H O ) ;
D a s s i g n i n g P o r t s ( H , X ˜ , H O ) ;                 /∗ ( (31)–(33) ( ∗/
The first step (vertex ordering) includes a pre-processing procedure for the initial hypergraph H; the corresponding function is denoted as h y p e r g r a p h R e s t r u c t u r i n g 1 in Algorithm 1. A detailed description of this function that returns a graph corresponding to hypergraph H is given in Algorithm 2.
Algorithm 2: The h y p e r g r a p h R e s t r u c t u r i n g 1 function.
Mathematics 10 00689 i001
To convert the hypergraph into a graph with the h y p e r g r a p h R e s t r u c t u r i n g 1 function, the so-called “balancing vertex” is introduced for each hyperedge e = ( S , T ) ; see Figure 11a,b. Then, each vertex v S T incident to the hyperedge is connected by a directed edge to the balancing vertex. This approach enables one to correctly take into account all possible intersections of edges.
The order of the vertices on the layers from h y p e r g r a p h R e s t r u c t u r i n g 1 ( H ) is determined using the o r d e r i n g function; see Algorithm 1. The vertex-ordering problem is solved using an integer program [10] that minimizes the number of edge crossings in a directed acyclic graph.
To assign preliminary abscissas to the vertices (step 2 of the mathematical heuristic), the function  a s s i g n i n g A b s c i s s a s is used. Again, hypergraph H is pre-processed with the h y p e r g r a p h R e s t r u c t u r i n g 2 function; see Algorithm 3. As a result of the transformation, every pair of adjacent vertices on the adjacent layers is connected by a directed edge; see Figure 11c.
Algorithm 3: The h y p e r g r a p h R e s t r u c t u r i n g 2 function.
Mathematics 10 00689 i002
Then, x-coordinates are assigned to the vertices based on the solution to a linear programming problem with objective function (6); see [9]. Note that the relative vertex order on each layer remains.
Once step 2 is over, three introduced functions— h o r i z o n t a l S e g m e n t s O r d e r i n g , remove-Overlapping, and  a s s i g n i n g P o r t s —are applied to obtain the hypergraph drawing. These functions correspond to steps 3, 4, and 5 of the mathematical heuristic, and their detailed description is presented below.
Knowing the x-coordinates of the vertices, the order of the horizontal segments of the hyperedges is determined. The objective function L that is minimized in step 3 is the number of hyperedge crossings:
min e 1 , e 2 E H C T e 1 , e 2 .
For each pair of hyperedges e 1 = ( S 1 , T 1 ) and e 2 = ( S 2 , T 2 ) , one can calculate the number of source nodes v S 2 and target nodes u T 2 that are inside the area of crossings of hyperedge e 1 . We denote these numbers as a c s ( e 1 , e 2 ) and a c t ( e 1 , e 2 ) , respectively. Then, the system of constraints for the integer programming problem with objective function (26) is as follows:
C T e 1 , e 2 a c s ( e 1 , e 2 ) + a c t ( e 2 , e 1 ) M × ( 1 H O e , e 2 ) e 1 , e 2 E H : e 1 e 2 .
C T e 1 , e 2 a c s ( e 2 , e 1 ) + a c t ( e 1 , e 2 ) M × H O e 1 , e 2 e 1 , e 2 E H : e 1 e .
0 H O e 1 , e 2 H O e 1 , e 3 + H O e 2 , e 3 1 e 1 , e 2 , e 3 E H : e 1 e 2 e 3 .
C T e 1 , e 2 0 , H O e 1 , e 2 { 0 , 1 } e 1 , e 2 E H : e 1 e 2 .
Constraints (27) and (28) are a simplified version of conditions (12)–(15) from the optimization model described in Section 3. The simplification is based on the fact that the x-coordinates of vertices are known. Expression (29) coincides with condition (18) and ensures that the transitivity condition is satisfied for the positions of the horizontal segments of any triplet of hyperedges. Condition (30) determines the domains of all of the variables in the problem.
The function h o r i z o n t a l S e g m e n t s O r d e r i n g —see Algorithm 1—is the solution to the mixed-integer program in (26)–(30). It returns the relative order of horizontal segments of the hyperedges.
In step 4, all non-feasible overlaps of vertical segments of hyperedges are removed by using the integer program proposed in [7]. This solution is denoted as the removeOverlapping function in Algorithm 1. Non-feasible overlaps must be eliminated by shifting the vertices on layers by a certain integer number of “single shifts” for each corresponding vertex x-coordinate while maintaining the relative order of the vertices on the layers. The objective function of the integer programming problem minimizes the total number of shifts of vertices, and the constraints are (7)–(21) with fixed values of the  H O variables for every pair of hyperedges.
The last step of the mathematical heuristic is the port assignment procedure when the relative order of ports is determined by the a s s i g n i n g P o r t s function for each hypergraph vertex—see Algorithm 4—where the a r r a n g i n g S y m m e t r i c a l l y function determines the x-coordinates of the port vertices by placing them symmetrically to the x-coordinate of the generating vertex without breaking the relative order of the port vertices.
Algorithm 4: The a s s i g n i n g P o r t s function.
Mathematics 10 00689 i003
For every generating vertex u, binary variables O R D u , v are introduced for each pair of port vertices u , v K U ( u ) or u , v K L ( u ) (relation u v holds) as follows:
O R D u , v = 0 , if port vertex u is to the right of port vertex v , 1 , otherwise .
A numerical parameter p o s ( u , e ) is defined for each pair consisting of a hyperedge e = ( S , T ) E H and a generating vertex u S T :
p o s ( u , e ) = 2 , if X u = max v S T X v , 0 , if X u = min v S T X v , 1 , otherwise .
Consider a pair of a hyperedge e = ( S , T ) E H and a generating vertex u S T . If  p o s ( u , e ) = 0 , then u is the leftmost vertex in a set of vertices incident to e, and if p o s ( u , e ) = 2 , then u is the rightmost one. The equality p o s ( u , e ) = 1 means that vertex u is between the leftmost and the rightmost vertices incident to e. Parameter p o s ( u , e ) enables one to define the value of  O R D u , v , i.e., the relative order of two port vertices u and v, as follows:
O R D u , v = U ( p o s ( C ( u ) , e 1 ) p o s ( C ( v ) , e 2 ) ) , if p o s ( C ( u ) , e 1 ) p o s ( C ( v ) , e 2 ) , 1 H O e 1 , e 2 , if p o s ( C ( u ) , e 1 ) = t y p e ( u ) , H O e 1 , e 2 , else .
where U denotes the unit step function, u and v are incident to the hyperedges e 1 and e 2 , respectively, u , v K U ( C ( u ) ) or u , v K L ( C ( u ) ) , u v , and a numerical parameter t y p e ( u ) takes the value 2 if port vertex u for the upper vertical segment of s U ( e 1 ) or 1 in the other case.
Once the relative order of all pairs of port vertices u , v , C ( u ) = C ( v ) is known, all of the port vertices of the generating vertex u are positioned so that their mean x-coordinate coincides with that of the center of u. The minimal and maximal distances ρ ( u , v ) and δ ( u , v ) (see Section 3) should be taken into account. Figure 12 illustrates a hypergraph layout that was obtained using the mathematical heuristic approach described above.

6. Numerical Results and Discussion

The approach to a solution of the hypergraph drawing problem proposed above was verified using synthetic initial data. The corresponding numerical results were analyzed for the multi-objective mixed-integer program in (5)–(21) and the mathematical heuristic (see Section 5) for a set of generated hypergraphs.
Wolfram Mathematica 12.3 [15] was used as a programming tool together with Gurobi Optimizer 9.1 [16]. All the numerical calculations were performed on an HP desktop, with an Intel Core i5 1.60 GHz CPU, 8 GB of RAM, and the Windows 10 operating system. The numerical results are presented in Table 1.
Three approaches were applied to obtain the numerical results, namely, the mathematical heuristic (see Section 5), mixed-integer program (5)–(21) with a higher priority of the objective function (5), and the same mixed-integer program enhanced by an initial feasible solution derived with the mathematical heuristic approach.
Each hypergraph is described by its ID. If the ID contains the prefix ms, then the hypergraph is considered to have multi-source hyperedges; otherwise, all the hyperedges in the hypergraph are single-source ones (prefix ss in the ID). The numbers of vertices and hyperedges are indicated in the column ( V , E H ). The column “Time in sec” gives information on the computation time for each numerical experiment. There is additional information (in parentheses) on how long it takes for Gurobi to find a solution that cannot be optimized with further iterations.

7. Conclusions

A new mathematical model for drawing a hierarchical hypergraph with vertex ports and multi-source orthogonal hyperedges is discussed in this paper. The model is based on the formulation of a mixed-integer program. One of the advantages of the model is that it enables one to simultaneously take into account a set of optimization criteria, including aesthetics ones (for overall hypergraph drawing), as well as the minimization of hyperedge crossings. The numerical results demonstrate that the number of hyperedge crossings can be minimized compared to the mathematical heuristic approach.
One of the application areas of the model is in financial flow visualization in information systems to create an initial drawing of a hypergraph. The initial layout is corrected when actual data are updated using the dynamic hierarchical graph-drawing algorithm [9].
Further directions of research include:
  • The generalization of the proposed mathematical model for reverse-directed hyperedges by adding port vertices to the model on the left and right sides of the generating vertices;
  • The development of a fast and efficient algorithm (heuristic, metaheuristic, column generation, etc.) for drawing large-scale hypergraphs.

Author Contributions

Conceptualization, G.F. and Y.V.; methodology, Y.V.; software, V.P.; validation, V.P.; formal analysis, G.F.; investigation, G.F., Y.V. and V.P.; resources, V.R.; data curation, G.F.; writing—original draft preparation, V.P.; writing—review and editing, G.F. and Y.V.; visualization, V.P.; supervision, G.F.; project administration, V.R.; funding acquisition, V.R. All authors have read and agreed to the published version of the manuscript.

Funding

The research was partially funded by the Ministry of Science and Higher Education of the Russian Federation as part of the World-Class Research Center program: Advanced Digital Technologies (contract No. 075-15-2020-903 dated 16.11.2020).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Collection of the hypergraphs generated: https://drive.google.com/drive/folders/1GQL3gKQsVoDMrAt-YkHCYhaBabM7wBN- (Accessed: 14 December 2021). Additional data presented in this study are available on request from the authors.

Conflicts of Interest

The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

References

  1. Spönemann, M. Graph Layout Support for Model-Driven Engineering; BoD–Books on Demand: Norderstedt, Germany, 2015. [Google Scholar]
  2. Helmke, S.; Goetze, B.; Scheffler, R.; Wrobel, G. Interactive, Orthogonal Hyperedge Routing in Schematic Diagrams Assisted by Layout Automatisms. In Diagrammatic Representation and Inference. Diagrams 2021; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2021. [Google Scholar] [CrossRef]
  3. Schulze, C.D.; Spönemann, M.; von Hanxleden, R. Drawing layered graphs with port constraints. J. Vis. Lang. Comput. Issue Diagr. Aesthet. Layout 2014, 25, 89–106. [Google Scholar] [CrossRef]
  4. Jünger, M.; Mutzel, P.; Spisla, C. More Compact Orthogonal Drawings by Allowing Additional Bends. Information 2018, 9, 153. [Google Scholar] [CrossRef] [Green Version]
  5. Sugiyama, K.; Tagawa, S.; Toda, M. Methods for visual understanding of hierarchical system structures. IEEE Trans. Syst. Man Cybern. 1981, 11, 109–125. [Google Scholar] [CrossRef]
  6. Sander, G. Layout of Directed Hypergraphs with Orthogonal Hyperedges. Graph Draw. 2003, 381–386. [Google Scholar] [CrossRef] [Green Version]
  7. Vasiliev, Y.M.; Fridman, G.M. Cooperation scheme visualization: Hyperedge routing method for hierarchical multilayer hypergraph. Sovrem. Ekon. Probl. Resheniia 2017, 3, 18–33. (In Russian) [Google Scholar] [CrossRef]
  8. Junger, M.; Mutzel, P. 2-layer straightline crossing minimization: Performance of exact and heuristic algorithms. J. Graph Algorithms Appl. 1997, 1. [Google Scholar] [CrossRef]
  9. Ismaeel, A.A.K. Dynamic Hierarchical Graph Drawing. Ph.D. Thesis, Karlsruher Instituts fur Technologie (KIT), Karlsruhe, Germany, 2012. [Google Scholar]
  10. Healy, P.; Nikolov, N.S. Hierarchical drawing algorithms. In Handbook on Graph Drawing and Visualization; CRC: Boca Raton, FL, USA, 2013; pp. 409–453. [Google Scholar]
  11. Spönemann, M.; Schulze, C.D.; Rüegg, U.; von Hanxleden, R. Counting Crossings for Layered Hypergraphs. In Diagrammatic Representation and Inference. Diagrams 2014; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2014; p. 8578. [Google Scholar] [CrossRef]
  12. Eschbach, T.; Guenther, W.; Becker, B. Orthogonal hypergraph drawing for improved visibility. J. Graph Algorithms Appl. 2006, 10, 141–157. [Google Scholar] [CrossRef]
  13. Šuvakov, M.; Andjelković, M.; Tadić, B. Hidden geometries in networks arising from cooperative self-assembly. Sci. Rep. 2018, 8, 1–10. [Google Scholar] [CrossRef] [Green Version]
  14. Tadić, B.; Andjelković, M.; Šuvakov, M.; Rodgers, G.J. Magnetisation Processes in Geometrically Frustrated Spin Networks with Self-Assembled Cliques. Entropy 2020, 22, 336. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  15. Wolfram Research. Wolfram Mathematica. Available online: https://www.wolfram.com/mathematica/ (accessed on 14 December 2021).
  16. Gurobi Optimization, LLC. Gurobi Optimizer. Available online: https://www.gurobi.com/products/gurobi-optimizer/ (accessed on 14 December 2021).
Figure 1. An example of the layering of a hierarchical hypergraph with orthogonal hyperedges according to the accepted rules.
Figure 1. An example of the layering of a hierarchical hypergraph with orthogonal hyperedges according to the accepted rules.
Mathematics 10 00689 g001
Figure 2. Reordering nodes on the lower layer of a graph leads to a decrease in the number of edge crossings: two crossings for the layout (a) and one crossing for the layout (b).
Figure 2. Reordering nodes on the lower layer of a graph leads to a decrease in the number of edge crossings: two crossings for the layout (a) and one crossing for the layout (b).
Mathematics 10 00689 g002
Figure 3. The same reordering nodes on the lower layer of the corresponding hypergraph leads to an increase in the number of hyperedge crossings: one crossing for the layout (a) and two crossings for the layout (b).
Figure 3. The same reordering nodes on the lower layer of the corresponding hypergraph leads to an increase in the number of hyperedge crossings: one crossing for the layout (a) and two crossings for the layout (b).
Mathematics 10 00689 g003
Figure 4. Optimal layout of a hypergraph; no ports allowed.
Figure 4. Optimal layout of a hypergraph; no ports allowed.
Mathematics 10 00689 g004
Figure 5. Layout of a hypergraph with ports for the source and target nodes: (a) non-optimal layout; (b) optimal layout with ports.
Figure 5. Layout of a hypergraph with ports for the source and target nodes: (a) non-optimal layout; (b) optimal layout with ports.
Mathematics 10 00689 g005
Figure 6. Examples of the non-feasible overlapping of hyperedges: (a) non-feasible overlapping of vertical segments; (b) non-feasible overlapping of horizontal segments.
Figure 6. Examples of the non-feasible overlapping of hyperedges: (a) non-feasible overlapping of vertical segments; (b) non-feasible overlapping of horizontal segments.
Mathematics 10 00689 g006
Figure 7. Transformation of hypergraph H into hypergraph H : (a) original hypergraph H; (b) hypergraph H obtained after inserting dummy vertices and port vertices.
Figure 7. Transformation of hypergraph H into hypergraph H : (a) original hypergraph H; (b) hypergraph H obtained after inserting dummy vertices and port vertices.
Mathematics 10 00689 g007
Figure 8. The area of crossings of hyperedge e 1 .
Figure 8. The area of crossings of hyperedge e 1 .
Mathematics 10 00689 g008
Figure 9. An example of the optimal layout of a hypergraph.
Figure 9. An example of the optimal layout of a hypergraph.
Mathematics 10 00689 g009
Figure 10. An example of the optimal layout of the hypergraph with the same ordinates of horizontal segments.
Figure 10. An example of the optimal layout of the hypergraph with the same ordinates of horizontal segments.
Mathematics 10 00689 g010
Figure 11. An example of a hypergraph transformation: (a) original hypergraph H; (b) restructuring a hypergraph into a directed graph with balancing vertices; (c) restructuring a hypergraph into a directed graph.
Figure 11. An example of a hypergraph transformation: (a) original hypergraph H; (b) restructuring a hypergraph into a directed graph with balancing vertices; (c) restructuring a hypergraph into a directed graph.
Mathematics 10 00689 g011
Figure 12. An example of layout of a hypergraph obtained with the mathematical heuristic.
Figure 12. An example of layout of a hypergraph obtained with the mathematical heuristic.
Mathematics 10 00689 g012
Table 1. Numerical results obtained using the mathematical heuristic (MH) and mixed-integer program (MIP) for a set of generated hypergraphs.
Table 1. Numerical results obtained using the mathematical heuristic (MH) and mixed-integer program (MIP) for a set of generated hypergraphs.
ID( V , E H )Time, in secNumber of Crossings
MHMIPMH+MIPMHMIP/MH+MIP
ms_n8_he4(8,4)0.51.6 (<1)1.34 (1)31
ms_n12_he6(12,6)0.522.78 (2)2.52 (2)41
ms_n14_he7(14,7)0.533.02 (2)2.91 (2)32
ms_n15_he7(15,7)0.5910.12 (5)5.82 (4)163
ms_n15_he8(15,8)0.53.05 (2)2.4 (2)20
ms_n16_he9(16,9)0.5721.07 (14)4.61 (4)31
ms_n18_he10(18,10)0.6344.87 (24)6.9 (6)134
ms_n19_he10(19,10)0.58130.2 (91)9.51 (8)73
ms_n20_he11(20,11)0.63497.9 (406)15.86 (14)177
ms_n27_he11(27,11)0.8634.34 (12)8.79 (8)228
ms_n22_he14(22,14)0.6439.56 (33)7.02 (6)144
ms_n41_he19(41,19)2.29690.8 (411)26.33 (24)7016
ss_n10_he7(10,7)0.534.48 (4)3.89 (3)31
ss_n11_he7(11,7)0.521.71 (<1)1.69 (1)40
ss_n20_he13(20,13)0.5746.81 (44)6.25 (6)20
ss_n27_he21(27,21)0.7535.81 (5)7.84 (6)61
ss_n40_he26(40,26)1.43136.4 (85)11.85 (10)257
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Fridman, G.; Vasiliev, Y.; Puhkalo, V.; Ryzhov, V. A Mixed-Integer Program for Drawing Orthogonal Hyperedges in a Hierarchical Hypergraph. Mathematics 2022, 10, 689. https://doi.org/10.3390/math10050689

AMA Style

Fridman G, Vasiliev Y, Puhkalo V, Ryzhov V. A Mixed-Integer Program for Drawing Orthogonal Hyperedges in a Hierarchical Hypergraph. Mathematics. 2022; 10(5):689. https://doi.org/10.3390/math10050689

Chicago/Turabian Style

Fridman, Gregory, Yuri Vasiliev, Vlada Puhkalo, and Vladimir Ryzhov. 2022. "A Mixed-Integer Program for Drawing Orthogonal Hyperedges in a Hierarchical Hypergraph" Mathematics 10, no. 5: 689. https://doi.org/10.3390/math10050689

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop