Computing the Union Join and Subset Graph of Acyclic Hypergraphs in Subquadratic Time
Abstract
We investigate the two problems of computing the union join graph as well as computing the subset graph for acyclic hypergraphs and their subclasses. In the union join graph of an acyclic hypergraph , each vertex of represents a hyperedge of and two vertices of are adjacent if there exits a join tree for such that the corresponding hyperedges are adjacent in . The subset graph of a hypergraph is a directed graph where each vertex represents a hyperedge of and there is a directed edge from a vertex to a vertex if the hyperedge corresponding to is a subset of the hyperedge corresponding to .
For a given hypergraph , let , , and . We show that, if the Strong Exponential Time Hypothesis is true, both problems cannot be solved in time for -acyclic hypergraphs and any constant , even if the created graph is sparse. Additionally, we present algorithms that solve both problems in time for -acyclic hypergraphs, in time for -acyclic hypergaphs, and in time for -acyclic hypergraphs as well as for interval hypergraphs, where is the size of the computed graph.
1 Introduction
A hypergraph is a generalisation of a graph in which each edge , called hyperedge, can contain an arbitrary positive number of vertices from . One may also see a hypergraph as a family of subsets of some set . Indeed, we say that the family of sets forms the hypergraph if and . We use , , and to respectively denote the cardinality of the vertex set, the cardinality of the hyperedge set, and the total size of all hyperedges of .
1.1 Acyclic Hypergraphs
A tree is called a join tree for if the hyperedges of are the nodes of and, for each vertex , the hyperedges containing induce a subtree of . That is, if , then is contained in each hyperedge (i. e., node of ) on the path from to in . A hypergraph is acyclic if it admits a join tree. There is a linear-time algorithm which determines if a given hypergraph is acyclic and, in that case, constructs a corresponding join tree for it [27].
Acyclic hypergraphs have various applications. They are, for example, a desired structure when designing relational databases [3]. There is also a close relation between acyclic hypergraphs and chordal as well as dually chordal graphs. Namely, a graph is chordal if and only if its maximal cliques form an acyclic hypergraph [18], and a graph is dually chordal if and only if its closed neighbourhoods form an acyclic hypergraph [8].
Tree-decompositions are another application. The idea is to decompose a graph into multiple induced subgraphs, usually called bags, where each vertex can be in multiple bags. The set of bags forms a tree in such a way that the following requirements are fulfilled: Each vertex is in at least one bag, each edge is in at least one bag, and is a join tree for the hypergraph . Usually tree-decompositions are considered with additional restrictions. The most known is called tree-width; it limits the maximum cardinality of each bag. For a graph class with bounded tree-width, many NP-complete problems can be solved in polynomial or even linear time. Alternatively, one may limit the distances between vertices inside a bag. Such a tree-decomposition can be used, for example, for constructing tree-spanners [13, 14] and efficient routing schemes [12].
An inclusion-maximal subset of vertices of a graph is called an atom if it induces a connected subgraph of without a clique separator. It is known that the atoms of a graph form an acyclic hypergraph [23]. The corresponding join tree is then called atom tree.
The most general acyclic hypergraphs are called -acyclic (i. e. ., each acyclic hypergraph is -acyclic). They are closely related to chordal graphs and to dually chordal graphs. Subclasses of -acyclic hypergraphs are -acyclic hypergraphs which are closely related to strongly chordal graphs and -acyclic hypergraphs which are closely related to ptolemaic graphs (graphs that are chordal and distance-hereditary). We also consider interval hypergraphs. These are acyclic hypergrpahs for which one of their join trees forms a path. As the name suggests, they are closely related to interval graphs. We give formal definitions and more information about each subclass later in their respective sections.
A class of hypergraphs closely related to acyclic hypergraphs are so-called hypertrees. These hypergraphs are defined in the same way as acyclic hypergraphs, except that the roles of vertices and hyperedges are exchanged. That is, a hypergraph is a hypertee if its vertices admit a tree such that each hyperedge induces a subtree of . The hypergraph resulting from exchanging the roles of vertices and hyperedges is called the dual hypergraph. (See Section 2 for a more formal definition.) Subsequently, a hypergraph is a hypertree if and only if it is the dual of an acyclic hypergraph.
Figure 1 shows the hierarchy of acyclic hypergraphs. See Brandstädt and Dragan [7] for a summary of known properties of acyclic hypergraphs as well as their relations to various graph classes.
1.2 Union Join Graph
Note that the join tree of an acyclic hypergraph is not always unique. For example, each tree with nodes is a valid join tree for the hypergraph formed by . The union join graph of a given acyclic hypergraph is the union of all its join trees. That is, each vertex of represents a hyperedge of and two vertices of are adjacent if there exits a join tree for such that the corresponding hyperedges are adjacent in . The union join graph of a hypergraph may also be called clique graph if represents the maximal cliques of a chordal graph [17, 20], or atom graph if represents the atoms of some graph [21]. In [5], Berry and Simonet present algorithms which compute the union join graph of an acyclic hypergraph in time.
1.3 Subset Graph
The subset graph of a hypergraph is a directed graph where each vertex represents a hyperedge of and there is a directed edge from a vertex to a vertex if the hyperedge corresponding to is a subset of the hyperedge corresponding to . Pritchard presents an algorithm in [26] that computes the subset graph for a given hypergraph in time. They also show that any subset graph has at most many edges. There are various publications that present algorithms for special cases and different computational models; see for example [15, 25] and the work cited therein.
The Strong Exponential Time Hypothesis, SETH for short, states that there is no algorithm that solves the Boolean satisfiability problem (without limitation on clause size) for some constant in time where is the number of variables in the given instance. A function is called truly subquadratic if for some constant . Borassi et al. [6] show that, if SETH holds, then there is no algorithm to compute the subset graph of an arbitrary hypergraph in truly subquadratic time, even if the output is sparse. Note that the results in [6] and [26] are not conflicting, since .
1.4 Our Contribution
In this paper, we investigate the two problems of computing the union join graph as well as computing the subset graph for acyclic hypergraphs and their subclasses. We show in Section 3 that there is a close relation between both problems by presenting reductions in both directions. It then follows that the result by Borassi et al. still holds when restricted to -acyclic hypergraphs and also applies to computing a union join graph. We then develop efficient algorithms to solve both problems for acyclic hypergraphs and their subclasses. In particular, we show that, if denotes the size of the computed graph , then both problems can be solved in time for -acyclic hypergraphs (Section 3), in time for -acyclic hypergaphs (Section 4), and in time for -acyclic hypergraphs (Section 5) as well as for interval hypergraphs (Section 6).
2 Preliminaries
Two graphs and are isomorphic if there is a bijective function such that if and only if . For simplicity, we write if they are isomorphic.
Let be a hypergraph. The incidence graph of is a bipartite graph were represents the vertices of , represents the hyperedges of , and there is an edge between two vertices and if the corresponding vertex (of ) is in the corresponding hyperedge . That is, , , and . Note that . If not stated or constructed otherwise, the incidence graphs of all hypergraphs occurring in this paper are connected, finite, undirected, and without multiple edges. Additionally, whenever a hypergraph is given, it is given as its incidence graph; hence, the input size is in . We say two hyperedges of are distinct if they are represented by two different vertices in , even if both hyperedges contain the same vertices.
Let be the incidence graph of some hypergraph . One can then exchange the roles of and to interpret as vertices and as hyperedges. We call the resulting hypergraph the dual hypergraph of and denote it as . Observe that, by definition, .
The 2-section graph of is the graph with the vertex set where two vertices and are adjacent if there is a hyperedge with . The line graph of is the intersection graph of its hyperedges. That is, with . It directly follows from these definitions that .
A sequence of vertices of forms a path in if, for each with , contains a hyperedge with . Let , , and be sets of vertices of . separates form if and each sequence of vertices that forms a path from to in contains a vertex from .
Let be the join tree of some acyclic hypergraph and let and be two hyperedges of which are adjacent in . We then call the set a separator of with respect to . If is rooted and is the parent of , we call the up-separator of . Note that each separator corresponds to an edge of and vice versa. We call the hypergraph formed by the set of all separators of the separator hypergraph for with respect to . It follows from properties ii and iii of Lemma 3 (see Section 3) that is always the same for a given , independent of the used join tree.
3 -Acyclic Hypergraphs
In this section, we investigate the problems of computing a union join graph and computing a subset graph for the most general case of acyclic hypergraphs. We first show that computing these graphs cannot be done in truly subqadratic time if the SETH is true. For that, we use a problem called Sperner Family problem. It asks whether a family of sets contains two sets and such that . If the SETH is true, then there is no algorithm that solves it truly subquadratic time [6]. Afterwards, we give an algorithm that allows to quickly compute the union join graph if a fast algorithm for the subset graph problem is given. Lastly, we give some additional notes on the Sperner Family problem and its generalisation.
3.1 Hardness Results
Let be a family of sets. We create an acyclic hypergraph from as follows. Create a new vertex (i. e., is not contained in any set ) and, for each set , create a hyperedge . Additionally, create a hyperedge which is the union of all hyperedges . Formally, we have that with and . One can create a join tree for by starting with and then making each hyperedge adjacent to it. Thus, is acyclic. Note that one can create and from in linear time.
For the remainder of this subsection, assume that we are given a family , a hypergraph , and a corresponding join tree for as defined above. Our results in this subsection are based on the following observation.
Lemma 1
contains two distinct sets and with if and only if there is a join tree for that contains the edge .
Proof
First, assume that contains two distinct sets and with . In that case, we can create a new join tree as follows. Remove the edge from and make adjacent to instead. Since , each element is also contained in . Thus, is a join tree for and contains the edge .
Next, assume that there is a join tree for with the edge . Without loss of generality, let be closer to in than . Recall that . Therefore, by properties of join trees, each vertex in is also in . It then directly follows from the construction of that .
We use the Sperner Family problem to show that there is no truly subquadratic-time algorithm to compute the union join graph of a given acyclic hypergraph. To do so, we first show the following.
Lemma 2
If the SETH is true, then there is no algorithm which decides in time whether or not a given acyclic hypergraph has a unique join tree.
Proof
Recall that we can create a join tree for by making each hyperedge adjacent to the hyperedge . To prove Lemma 2, we show that contains two distinct sets and with if and only if is not a unique join tree for .
First, assume that contains two such sets and . In that case, Lemma 1 implies that there is a join tree for with the edge . Since is not an edge in , is not unique. Next, assume that is not unique. Then, there is a join tree and a hyperedge such that is not adjacent to in . Hence, is adjacent to some hyperedge that is closer to in than . Since , properties of join trees imply that . Subsequently, due to Lemma 1, .
It follows that a truly subquadratic-time algorithm which determines if an acyclic hypergraph has a unique join tree would imply an equally fast algorithm to solve the Sperner Family problem for any family of sets.
Note that, by definition of a union join graph, has a unique join tree if and only if the union join graph of is a tree. Therefore, we get the following.
Theorem 3.1
If the SETH is true, then there is no algorithm which constructs the union join graph of a given acyclic hypergraph in time, even if that graph is sparse.
We now show that computing the subset graph of an acyclic hypergraph is as hard as computing the subset graph for a general family of sets.
Theorem 3.2
If the SETH is true, then there is no algorithm which constructs the subset graph of a given acyclic hypergraph in truly subquadratic time.
Proof
Let be the subset graph for and be the subset graph for . Since, by construction of , if and only if , contains the edge if and only if contains the edge . We can therefore construct from by simply removing the vertex representing from (and its incident edges).
Recall that we can construct from in linear time. Therefore, a truly subquadratic-time algorithm to construct the subset graph of a given acyclic hypergraph would imply an equally fast algorithm to construct a subset graph of a given family of sets.
3.1.1 Note on Hypertrees.
Observe that, in the hypergraph as constructed above, each hyperedge contains the vertex . We can therefore create a tree by making each other vertex a leaf adjacent to . Each hyperedge of now induces a subtree of , i. e., is a hypertree.
3.2 Union Join Graph via Subset Graph
In the previous subsection, we show how to compute the subset graph using the union join graph of an acyclic hypergraph. We now present an algorithm that computes the union join graph of a given acyclic hypergraph with the help of a subset graph. The runtime of our algorithm then depends on the runtime required to compute that subset graph.
For the remainder of this subsection, assume that we are given an acyclic hypergraph and let be the union join graph of (with for us unknown edges). Lemma 3 below gives various characterisations for .
Lemma 3
For any distinct , the following are equivalent.
-
(i)
is an edge of .
-
(ii)
has a join tree with the edge .
-
(iii)
Each join tree of has an edge on the path from to in such that .
-
(iv)
Each join tree of has a separator on the path from to in with and where and are the separators in which are respectively closest to and .
-
(v)
separates from .
Most of the properties in Lemma 3 repeat, generalise, or paraphrase existing results (see [5, 17, 20]). Property iv is, to the best of our knowledge, a new observation. For completeness, however, we prove all of them.
Proof
By definition of , properties i and ii are equivalent. It follows from properties of join trees that ii implies v.
We next show that v implies iii. Assume that and are not adjacent in a join tree . Then there is a path of hyperedges from to in . For each with , let be the separator corresponding to the edge of . By properties of join trees, for each . Now assume that each contains a vertex . Then, would form a path in from to . That contradicts with property v. Therefore, there is at least one separator with , i. e., there is an edge in with .
To show that iii implies ii, consider a join tree where and are not adjacent. We can create a join tree by removing the edge and adding the edge instead. Since and are on different sides of in , is also a tree. Additionally, because , is a valid join tree for .
It remains to show that iv is equivalent to iii. We first assume property iii. Let be a separator on the path from to in some join tree . Since, by properties of join trees, each vertex in is also in and , it follows that and . Now assume property iv. Because and , it is also the case that . Since is on the path from to in , each vertex that is in both and also has to be in , i. e., . Therefore, .
Based on Lemma 3, we can construct as follows. Compute a join tree for , the separator hypergraph (with respect to ), and its subset graph . Next, use to find all triples of separators which satisfy property iv of Lemma 3. Since their corresponding hyperedges are then adjacent in some join tree of , make the corresponding vertices adjacent in .
Before analysing our approach further, we address some needed preprocessing. Assume that contains two hyperedges and which are not adjacent in , but are adjacent in some other join tree. There might then be multiple separators on the path from to in which satisfy property iv of Lemma 3. Our algorithm would, therefore, add the edge to multiple times, once for each such . While it is easy to remove redundant edges from afterwards, we still want to ensure that the time needed to create and remove these edges does not become too much. To achieve that, Algorithm 1 modifies such that each hyperedge becomes adjacent to its highest possible ancestor in . As by-product, Algorithm 1 also computes the up-separator of each hyperedge (and, thus, the separator hypergraph ).
Lemma 4
Algorithm 1 runs in linear time.
Proof
Line 1 runs in time, since the nodes of are the hyperedges of . Recall that is given as an incidence graph . Hence, the following are equivalent (with respect to runtime): (i) for each vertex, iterating over all hyperedges containing it; (ii) for each hyperedge, iterating over all vertices it contains; and (iii) iterating over all edges of . Therefore, line 1, line 1, and line 1 (and subsequently Algorithm 1) run in total time.
Lemma 5
The tree created by Algorithm 1 is a valid join tree for .
Proof
Let be the tree after processing , i. e., and . Thus, is a valid join tree for . Assume, by induction, that (with ) is a valid join tree for too. Recall that, by definition of join trees, the set of hyperedges containing a vertex form a subtree of . The roots of all such where are ancestors of in and, thus, form a path. By definition of (line 1), is the lowest of such roots in . It therefore follows that . Subsequently, for each , the hyperedges containing still form a subtree of after changing the parent of if they did so in . Note that each subtree of a vertex remains unchanged, since it does not contain the edge . Therefore, for each vertex, the hyperedges containing it form a subtree of and, thus, is a join tree for .
Lemma 6
Let and be two hyperedges of , be the tree computed by Algorithm 1, and be the path from to in . Additionally, let and be the separators on which are closest to and , respectively. There are at most two separators on such that and .
Proof
Let be the lowest common ancestor of and in . Although has a potentially different structure than , it is still the case that the parent of a hyperedge in was an ancestor of it in . Thus, . Note that goes through and let and be the respective subpaths of . If contains more than two separators as defined in Lemma 6, at least two of them are either part of or . Without loss of generality, let them be on and let be the lowest such separator. Additionally, let be the hyperedge directly below , i. e., . It follows that is not adjacent to in .
Since , each vertex in is in all hyperedges on the path from to in , including . Therefore, and . That is a contradiction, since Algorithm 1 would have made adjacent to or one of its ancestors.
Algorithm 2 now implements the approach described above. It also uses Algorithm 1 as preprocessing. Therefore, due to Lemma 6, the algorithm adds each edge at most two times into .
Theorem 3.3
Algorithm 2 computes the union join graph of a given acyclic hypergraph in time where is the runtime of a given algorithm with the separator hypergraph of as input.
Proof (Correctness)
Let and be two hyperedges of . Additionally, let and be the separators on the path from to in (computed in line 2) which are closest to and , respectively. We show the correctness of Algorithm 2 by showing that is an edge of if and only if there is a join tree for with the edge .
First, assume that there is a join tree for with the edge . Lemma 3 then implies that there is a separator such that , , and and are on different sides of in . Therefore, when processing , the algorithm finds and (line 2) and consequently adds and into (line 2). Since both hyperedges are on different sides of , Algorithm 2 then also adds the edge to (line 2).
We now assume that is an edge of . Note that Algorithm 2 only adds edges to in line 2. Thus, there is a separator for which the algorithm adds to . For that , one of and is in and the other is in (line 2) and, hence, and are on different sides of in (line 2). This implies that and (line 2 and line 2). Therefore, by Lemma 3, there is a join tree for with the edge .
Proof (Complexity)
Creating a join tree for a given acyclic hypergraph can be implemented in time [27]. Modifying that join tree (thereby computing ) and computing using Algorithm 1 can also be done in time (Lemma 4). Thus, line 2 runs in total time. Computing the subset graph in line 2 requires time. Since the hyperedges of form the vertices of and since is created without edges, line 2 runs in time.
We show next that a single iteration of the loop starting in line 2 runs in time. That is, the runtime for a single iteration is (asymptotically) equivalent to the number of edges of created. Note that each iteration creates at least one such edge, namely the edge in that represents. Additionally, Lemma 3 and Lemma 6 imply that each edge is added at most twice to . Therefore, line 2 to line 2 run in total time.
For a separator , let denote the set of separators with . Since the subset graph is given, one can compute (line 2) in time by determining all incoming edges of in . For each , the algorithm adds, in line 2, exactly one hyperedge into plus one additional hyperedge for . Thus, .
One can determine the hyperedges and that form a separator , which one is farther from , and on which side of they are in as follows. When creating , add a reference to both hyperedges and include which is the parent and which is the child in . Now assume that each is also a node of adjacent to and . Root in an arbitrary hyperedge, run a pre-order and post-order on , and let and be the indices of a node in that respective order. For two distinct nodes and of (representing either separators or hyperedges), is then a descendant of if and only if and . There are four cases when determining which of and to add into : if and represent the same edge of , add both hyperedges; if is a descendant of , add the child-hyperedge; if is an ancestor of , add the parent-hyperedge; and if is neither an ancestor nor a descendant of , add the child-hyperedge. Clearly, one side of contains all its descendants and the other side all remaining hyperedges and separators. That allows us, after a -time preprocessing, to determine in constant time on which side of a give a hyperedge is. Therefore, line 2 and line 2 run in time.
Recall that there is an algorithm which computes the subset graph for any given hypergraph in time [26]. Thus, we have the following.
Theorem 3.4
There is an algorithm that computes the union join graph of an acyclic hypergraph in time.
The upper bound of at most many edges for any subset graph [26] does not apply to union join graphs. Consider a hypergraph with and where . Note that and that each tree with as nodes is a valid join tree for . Hence, the union join graph of is a complete graph with edges.
3.3 Notes on the Sperner Family Problem and its Generalisation
An interesting question that remains is the complexity of solving the Sperner Family problem for acyclic hypergraphs and hypertrees. We first answer this question for hypertrees.
Theorem 3.5
If the SETH is true, then there is no algorithm which solves the Sperner Family problem for a given hypertree in time.
Proof
We prove the theorem by making a simple linear-time reduction. Consider a family of sets. Create a new vertex and add it to each set . Let be the resulting set. The family then forms a hypertree. Clearly, adding to each set does not change any subset relations. Therefore, contains two distinct sets and with if and only if contains two distingt sets and with .
For acyclic hypergraphs we have the following result.
Theorem 3.6
There is a linear-time algorithm to solve the Sperner Family problem for acyclic hypergraphs.
Proof
Let be an acyclic hypergraph with a join tree . We first show that the following are equivalent: (i) has two distinct hyperedges and with , and (ii) has an edge with . Clearly, (ii) implies (i). To show that (i) implies (ii), let and be two distinct hyperedges of with . It follows from the definition of join trees that for each hyperedge on the path from to in . Therefore, contains an edge with and, thus, (i) is equivalent to (ii).
Let be an edge of with , and let be the separator corresponding to that edge. Note that in such a case. Hence, it follows that (i) is true if and only if admits a separator such that or .
We can now solve the Sperner Family problem for a given acyclic hypergraph in linear time as follows. Construct the separator hypergraph for (see Algorithm 1). For each separator , determine if or . In that case, return True. Otherwise, if no such separator is found, return False.
Theorem 3.2 and Theorem 3.6 together give an interesting observation: Let he a class of hypergraphs. Existence of an algorithm that solves the Sperner Family Problem for in truly subquadratic time does not imply that there is such an algorithm to compute a subset graph for hypergraphs in , even if the resulting graph is sparse.
One can generalise the Sperner Family Problem as follows: How many pairs of distinct sets with does a given a family contain? Let be that number. The Sperner Family problem is then equal to the question whether or not . Thus, Theorem 3.6 gives linear-time algorithm to determine if for acyclic hypergraphs. The reduction for Lemma 2, however, implies that there is no truly subquadratic-time algorithm that determines if . What remains an open question is the required runtime to determine if for any fixed with .
4 -Acyclic Hypergraphs
A hypergraph is -acyclic if each subset of forms an acyclic hypergraph. They are also known as totally balanced hypergraphs [11]. See [16] for more definitions. In this section, we present an algorithm to compute the subset graph of -acyclic hypergraphs in time. Afterwards, we show that one can use that algorithm together with Algorithm 2 to compute the union join graph in the same amount of time.
4.1 Constructing the Subset Graph
A matrix is binary if its entries are either or . The binary matrix is called . A matrix is -free if it contains no as submatrix. Note that the rows and columns which form a submatrix do not need to be adjacent in the original matrix. One can use a binary matrix to represent a given hypergraph as follows. Let each row represent a vertex and each column represent a hyperedge . An entry is then if and only if . That matrix is called the incidence matrix of .
A matrix is doubly lexically ordered if rows and columns are permuted in such a way that rows vectors and columns are both in non-decreasing lexicographic order (rows from left to right and columns from top to bottom). Within a row, priorities of entries are decreasing from right to left, and, within a column, priorities of entries are decreasing from bottom to top. One can compute such an ordering in time [24]. Note that the algorithm in [24] does not compute the actual matrix; it only computes the corresponding ordering of vertices and hyperedges, thereby avoiding a quadratic runtime.
Lemma 7
For the remainder of this subsection, assume that we are given a -acyclic hypergraph . Let be a doubly lexically ordered (hence, -free) incidence matrix for . We assume that we know the ordering of vertices and hyperedges in , even though we are not given itself. For two hyperedges and of , we say if the column of is lexicographically smaller than or equal to the column of with respect to . Accordingly, we write to exclude equality.
Lemma 8
Let and be two hyperedges of and let be the vertex in which is earliest in the doubly lexical ordering (i. e., highest in ). Then, if and only if and .
Proof
We first show that and implies . Clearly, if . Assume now that , i. e., contains a vertex . By definition of , is lower in than . and then imply that , , , and form a in . That contradicts with being -free (see Lemma 7). Therefore, or .
Clearly, implies . Now assume that . Since , there is a lowest vertex in which is in one of these hyperedges but not in both. Recall that is ordered lexicographically. Therefore, implies that ( in ) and ( in ), i. e., .
Lemma 8 allows to compute the subset graph of a -acyclic hypergraph as follows. First, find doubly lexicographical ordering of vertices and hyperedges. For each hyperedge , determine all hyperedges with which contain as defined in Lemma 8. Then, add the edge to for each such pair and . Algorithm 3 implements that approach.
Theorem 4.1
Algorithm 3 computes the subset graph of a given -acyclic hypergraph in time.
Proof (Correctness)
Proof (Complexity)
One can compute a doubly lexicographical ordering (line 3) in time [24]. Creating the graph (line 3) can easily be done in time.
There are various ways to then order the adjacency list of (line 3) in time. One option is to reconstruct as follows. Iterate over all vertices of as ordered in . For each hyperedge containing , add to the new list of . Afterwards, the list of vertices in is ordered with respect to . The same approach (with hyperedges and vertices swapped) allows to sort, for each vertex , the list of hyperedges containing it.
We now show that the loop starting in line 3 runs is in total time. Note that the hyperedges form the vertices of . Hence, there is exactly one iteration of the loop starting in line 3 for each vertex of . Since the adjacency list of is ordered according to (line 3), we can determine (line 3) in constant time for each hyperedge . For the same reason, we can determine the set in time by iterating backwards over the hyperedges containing . Since we add exactly one edge to for each in such , line 3 and line 3 run in total time.
4.2 Constructing the Union Join Graph
We now address how to compute the union join graph for -acyclic hypergraphs. For that, we do not present a new algorithm. Instead, we show that one can use Algorithm 2 together with Algorithm 3. This is possible due to Lemma 9 below.
Lemma 9
If a hypergraph is -acyclic, then its separator hypergraph is -acyclic, too.
Before proving Lemma 9, we need a few auxiliary definitions. Assume we are given a graph . A clique is a set of vertices of such that all these vertices are pairwise adjacent. Such a clique is maximal if no vertex in is adjacent to all vertices in . For a cycle , a chord is an edge between two non-consecutive vertices. A graph is called chordal if each cycle with four or more vertices has a chord. A hypergraph is conformal if, for each maximal clique of , contains a hyperedge with .
Proof (Lemma 9)
Let be a -acyclic hypergraph with a join tree and let be the hyperedges of . To prove that is -acyclic, we show that each forms an acyclic hypergraph. It is known that a hypergraph is acyclic if and only if is conformal and is chordal [3]. It is therefore sufficient for us to show that each is conformal and its 2-section graph is chordal.
We start by showing that is chordal. Let us assume that is not chordal. It then contains a chordless cycle with . Since each edge of implies that its vertices are in a common hyperedge, there is a sequence of separators that form in . In particular, we have that (with index arithmetic modulo ). Recall that each separator corresponds to an edge of . Let be the smallest subtree of that contains all separators of . Note that for all ; otherwise would have a chord. Therefore, by properties of join trees, there is no and such that separates and in . Hence, each in corresponds to a leaf of . By properties of join trees, . Hence, is not chordal implying that does not form an acyclic hypergraph. This contradicts with being -acyclic. Therefore, is chordal.
We now show that each forms a conformal hypergraph. Gilmore’s Theorem [4] states that a hypergraph is conformal if and only if, for all its hyperedges , , and , contains a hyperedge such that . is therefore clearly conformal if . Now let and let , , and be three hyperedges in . We distinguish between two cases. Case 1: , , and are on a path in . Without loss of generality, let be between and . Then, by properties of join trees, . Case 2: There is a hyperedge in such that , , and are in different subtrees when removing from . For all , let represent the edge of and let be closer to in than . Since is -acyclic, the set also forms an acyclic and, hence, conformal hypergraph. Without loss of generality, let be the hyperedge that satisfies Gilmore’s Theorem for , i. e., let . Note that, by properties of join trees, for all , and if . Therefore, . Overall, it then follows each forms a conformal hypergraph.
Due to Lemma 9, we can conclude this section as follows.
Theorem 4.2
There is an algorithm that computes the union join graph of a given -acyclic hypergraph in time.
Proof
Let be the given hypergraph. Because the separator hypergraph is -acyclic (Lemma 9), we can use Algorithm 3 to compute its subset graph in time. Thus, when using and Algorithm 3 as input, Algorithm 2 computes the union join graph of in time. Consider again line 2 to line 2 of Algorithm 2. Note that for each edge of , there is at least one edge added to . It follows that and, therefore, one can compute in total time.
5 -Acyclic Hypergraphs
In [16], Fagin gives various definitions of -acyclic hypergraphs and presents a polynomial-time recognition algorithm for them. The definition for -acyclic hypergraphs we give below uses a strong relation between these hypergraphs and distance-hereditary graphs. Before that, we give a few auxiliary definitions and an interesting property of distance-hereditary graphs.
Let be a connected, undirected, and simple graph without loops or multiple edges. The open and closed neighbourhood of a vertex are respectively defined as and . A vertex is pendant if . Two vertices and are false twins if , and are true twins if . A graph is distance-hereditary if every induced subgraph is distance preserving, i. e., the distance between two vertices and remains the same in every connected induced subgraph of that contains and .
An ordering for a graph is called a pruning sequence if each with satisfies one of the following conditions in the subraph of induced by : (i) is pendant, (ii) is a true twin of some vertex , or (iii) is a false twin of some vertex . A graph is distance-hereditary if and only if admits a pruning sequence [2].
The recognition algorithm in [16] decides whether or not a given hypergraph is -acyclic by determining if the corresponding incidence graph admits a pruning sequence. Additionally, Ausiello et al. [1] show that the incidence graphs of -acyclic hypergraphs are so-called (6, 2)-chordal bipartite graph which are known to be equivalent to bipartite distance-hereditary graphs [10]. Therefore, we can define -acyclic hypergraphs as follows.
Corollary 1
5.1 Constructing the Union Join Graph
Lemma 10
An acyclic hypergraph is -acyclic if and only if its line graph is isomorphic to its union join graph.
Proof
Let be an acyclic hypergraph with two distinct hyperedges and , and let be the union join graph of . Consider the following statements: (i) is an edge of , (ii) , (iii) separates from , and (iv) is an edge of . Due to definitions and due to Lemma 3, it follows that (i) is equivalent to (ii), that (iii) implies (ii), and that (iii) is equivalent to (iv).
To prove Lemma 10, we first assume that is -acyclic. It is know [16] that a hypergraph is -acyclic if and only if (ii) implies (iii) for all distinct hyperedges and . Therefore, if is -acyclic, the statements (i), (ii), (iii), and (iv) are equivalent and, subsequently, .
Now assume that , i. e., that (i) and (iv) are equivalent for all distinct hyperedges and . It then follows that (ii) and (iii) are equivalent and, as a result, that (ii) implies (iii). The same observation from [16] then implies that is -acyclic if .
Theorem 5.1
There is an algorithm that computes the union join graph of a given -acyclic hypergraph in time.
Proof
Due to Lemma 10, we can compute the union join graph of a -acyclic hypergraph by computing its line graph. Note that, by definition, . It follows from Corollary 1 that the dual hypergraph is -acyclic too. Therefore, we can compute as follows.
Let be a join tree of rooted in an arbitrary node. Process each hyperedge of according to a pre-order on . When processing a hyperedge of , pick a vertex that has not been flagged, make adjacent (in ) to all flagged vertices in , and then flag . Repeat that until all vertices in are flagged and afterwards continue with the next hyperedge.
By flagging vertices, we ensure that an edge is added to at most once even if both vertices are together in multiple hyperedges of . Therefore, since we can construct in time [27], we can construct from in time.
5.2 Constructing the Subset Graph
5.2.1 Bachman Diagrams.
Consider a hypergraph , let be a subset of , and let be the intersection of all hyperedges in . We then define as the set of all such which are non-empty, i. e.,
The Bachman diagram of is a directed graph with the node set such that there is an edge from to if and there is no with . Note that, if contains two distinct hyperedges and with the same vertices, they are represented by the same node in .
Lemma 11
[16] A hypergraph is -acyclic if and only if its Bachman diagram forms a tree.
In a Bachman diagram as defined above, a vertex of is often contained in multiple nodes. A technique from [28] allows us to construct a more compact representation of . Let be the set of nodes such that is an edge of . We then define the label of as . As a result, a vertex of is only in the label of the “smallest” node containing it. Consider now a Bachman diagram with the node set where we replace each node with . We call the resulting graph a simplified Bachman diagram of . Figure 2 gives an example.
Let be a simplified Bachman diagram for a hypergraph . We use the following functions and notations when working with and . The function maps onto the nodes of such that returns the node which represents . Accordingly, we define for all nodes of . Similar to , we define as a function that maps onto the nodes of such that returns the node which contains . For two nodes and , we write to state that there is a path form to in . Note that we assume that . Lastly, we define . Note that is effectively the inverse of the label function we used above.
5.2.2 Subset Graph via Simplified Bachman Diagrams.
We can make the following observation: For two hyperedges and of , if and only if in the (simplified) Bachman diagram of . In the remainder of this subsection, we present algorithms which first constructs a simplified Bachman diagram for a given -acyclic hypergraph and then uses the previous observation to compute the subset graph of in time.
To the best of our knowledge, there exist only two published algorithms which compute (simplified) Bachman diagrams. Kumar et al. [22] present an -time algorithm to compute a Bachman diagram for a -acyclic database schema. Uehara and Uno [28] present a linear-time algorithm that computes a simplified Bachman diagram for the maximal cliques of a ptolemaic graph; these cliques form a -acyclic hypergraph [11]. Using that algorithm would require us to first compute the 2-section graph of . That may result in overall quadratic runtime for some hypergraphs. We therefore use neither of these algorithms. Instead, we present a new algorithm which computes a simplified Bachman diagram for a given -acyclic hypergraph in time.
Recall that the incidence graph of a -acyclic hypergraph is distance-hereditary. It therefore admits a pruning sequence . Note that each in can represent either a vertex or a hyperedge of . The idea for our algorithm is to iterate over and to step by step construct . For that, let denote the subgraph of induced by .
We start the construction with and . Note that one of them has to represent a vertex and the other a hyperedge of . Therefore, we initialise with a single node and set and .
Next, we iterate over , starting with . Since incidence graphs are bipartite, it is never the case that is the true twin of some (with the exception of ). Hence, we have four possible cases for each : (i) represents a vertex of and is a false twin in , (ii) represents a hyperedge and is a false twin, (iii) represents a vertex and is pendant, or (iv) represents a hyperedge and is pendant.
If is a twin (cases i and ii), the idea is to make the new vertex or hyperedge behave as its twin. For a vertex , that means to add into the same node of . In case of a hyperedge , it is represented by the same node of as its twin.
If is pendant, adding it may affect the structure of . For example, let represent a vertex added to a hyperedge (case iii). If, with respect to , is not subset of another hyperedge (including not being a twin), then we can simply add into . However, if is subset of some hyperedge, it is no longer after adding . We subsequently need to update the structure of . To do so, we add a new node , make it the representative of , and add an edge from to the node of which previously represented . We handle case iv in a similar way.
Algorithm 4 implements the approach above and describes in detail how to handle each of the four cases for .
Lemma 12
Algorithm 4 computes a simplified Bachman diagram for a given -acyclic hypergraph in linear time.
Proof (Correctness)
We start by showing that forms a tree. Algorithm 4 starts constructing with a single node (line 4). Whenever the algorithm adds a new node to (line 4 and line 4), it is incident to exactly one edge. Additionally, no other edge is ever added to or removed from . Therefore, forms a tree.
To show that is a simplified Bachman diagram for , we show that it satisfies the following two properties:
-
(1)
For each vertex of , contains exactly one node with ; additionally, .
-
(2)
There is a bijection mapping onto the nodes of such that ((2.)) if and only if , and ((2.)) for some hyperedge implies .
Property 2 ensures that the nodes of represent the nodes of a Bachman diagram for . Property 1 then enforces that the nodes of are connected properly. Without it, one could satisfy 2 by constructing a graph . Additionally, since forms a tree, it does not contain transitive edges.
Observe that whenever a new vertex is added (lines 4, 4, 4, and 4), Algorithm 4 adds it into a node and sets accordingly. In the case that an existing vertex is added into a new node (line 4), the algorithms removes it from its previous node and updates accordingly. Therefore, the graph constructed by Algorithm 4 satisfies property 1.
In the remainder of this proof, we show that satisfies property 2 via an induction over . For that purpose, let denote the hypergraph formed by and let be graph constructed after processing . We also use subscript to indicate that we refer to a version of a set, node, hyperedge, or function with respect to or ; for larger expressions , we may write .
Case i: represents a vertex and is a false twin in .
Let be the vertex represented by a twin of . Since and are twins, it follows that if and only if for each hyperedge of Subsequently, the only change to is that is added to the sets which contain . That is, for each , if and if . Observe that the algorithm neither adds any nodes nor any edges to the graph. It only adds into . Hence, for each node of , if and if . Therefore, satisfies property 2.
Case ii: represents a hyperedge and is a false twin in .
Recall that we defined Bachman diagrams and the family in such a way that does not contain two equal sets, even if contains multiple equal hyperedges. Hence, adding a hyperedge which is equivalent to an existing hyperedge does neither change nor any of the sets contained in it. It follows that setting is the only change needed for to satisfy property 2 (otherwise would violate 2(2.)). Algorithm 4 does exactly that in line 4.
Case iii: represents a vertex and is pendant in .
Let be the hyperedge represented by the neighbour of in (i. e., ), and let . Assume that, for each hyperedge of which is distinct from , . In that case, and has incoming edge in . (As result, Algorithm 4 calls line 4.) Since is only added into , is almost identical to except that the set which represents now contains . Because has incoming edge in , adding into it (line 4) does not affect other nodes. In particular, for all nodes of which are distinct from , and . Therefore, satisfies property 2.
Assume now that contains a hyperedge distinct from with . In that case, and, thus, (if ) or has incoming edge in . (As result, Algorithm 4 calls line 4.) Since is only added into but not , . However, for all with and , . Therefore, with . For each , let . Additionally, let where is the node added to in line 4. Thus, is a bijection mapping onto the nodes of . Since the added edge points towards , for all nodes of and . Hence, satisfies property 2(2.). Additionally, since the algorithm also sets , also satisfies property 2(2.).
Case iv: represents a hyperedge and is pendant in .
Let be the vertex represented by the neighbour of in (i. e., ), and let . Assume that contains a set with . In that case, adding does neither change nor any of the sets contained in it. Additionally, and has no outgoing edges in . It follows that setting is the only change needed for to satisfy property 2 (similar to case ii). Algorithm 4 does exactly that in line 4.
Assume now that, for each set , . In that case, with . Additionally, or has an outgoing edge in . Let for each , and let where is the node added to in line 4. Thus, is a bijection mapping onto the nodes of . Note that Algorithm 4 (in line 4) moves from node into the new node . However, since the added edge points towards , for all nodes of and . Therefore, due to the algorithm setting , satisfies property 2.
Proof (Complexity)
One can compute a pruning sequence for a given distance-hereditary graph in linear time [9] and, thus, for (line 4) in time. Creating and adding the first node (lines 4 and 4) can then be done in constant time. For each node of , we create two lists. One stores the vertices in and one the hyperedges in . For the functions and , we store the node they map on and a reference to where the hyperedge or vertex is stored in the corresponding list of . That way, we can perform each of the following operations in constant time: adding new nodes and edges into (lines 4 and 4), assigning a hyperedge to a node and setting (lines 4, 4, and 4), changing the assignment of a hyperedge to a different node and updating (line 4), adding a vertex into a node and setting (lines 4, 4, and 4), and moving a vertex from one node into another and updating (line 4). Therefore, each iteration of the loop starting in line 4 run in constant time and, subsequently, Algorithm 4 run in overall linear time.
Lemma 13
Each node of with has an in-degree of at least .
Proof
We first assume that has in-degree . Then, there is no hyperedge with and, subsequently, no such with . That contradicts with the definition of Bachman diagrams.
Now assume that has at least one incoming edge . Let and . Since , there is a hyperedge with and . Hence, since , there is a path from to in that does not contain and, therefore, has an in-degree of at least .
Theorem 5.2
Algorithm 5 computes the subset graph of a given -acyclic hypergraph in time.
Proof (Correctness)
Let and be two distinct hyperedges of . By definition of (simplified) Bachman diagrams, (computed in line 5) contains two nodes and such that if and only if . Additionally, Algorithm 5 adds the edge to (line 5) if and only if . Therefore, for any distinct hyperedges and of , is an edge of if and only if .
Proof (Complexity)
Computing the simplified Bachman diagram (line 5) can be done in time (Lemma 12). Creating the graph (line 5) can be done in time. Additionally, once the sets are known for all , we can add the edges of (line 5) in total time. It remains to show that we can compute the sets in the desired runtime. To do that, we show that we can compute for a given in time.
Recall that is a directed graph which forms a tree (Lemma 11). Hence, the the nodes of from which there is a path to form a tree rooted in where each edge points from a child to its parent. One can compute in time by, for example, reversing the edges of and then performing a BFS or DFS starting at .
Assume that we partition the nodes of into two sets and where and contains all remaining nodes. It follows from Lemma 13 that each node of with at most one child (including leaves) is in , and each node in has at least two children. Now assume that we, step by step, remove each node from which has exactly one child , and make the child of ’s parent. Let be the resulting tree. Each node of then has at least two children. Thus, at least half of the nodes of are leaves. Since each leaf is in and contains all nodes in , it follows that and, subsequently, .
Recall that for all and that each hyperedge of is associated with at most one such . It follows that . Therefore, we can compute for a given in time, and line 5 runs in total time.
6 Interval Hypergraphs
An acyclic hypergraph is an interval hypergraph if it admits a join tree that forms a path. That is, there is an order for the hyperedges of such that, for each vertex , implies that for all with . Interval hypergraphs are closely related to interval graphs which are a subset of chordal graphs. In particular, a graph is an interval graph if and only if its maximal cliques form an interval hypergraph, and an acyclic hypergraph is an interval hypergraph if and only if its 2-section graph is an interval graph.
Algorithm 9 in [19] allows to recognise interval hypergraphs in linear time. It also produces an order as defined above. Note that the first step of that algorithm is to compute a clique tree and a vertex ordering for a given graph. We replace that step by first computing a join tree of the given hypergraph and then perform Algorithm 10 from [19] to compute .
There are multiple ways to compute the subset graph and union join graph once is known for a given hypergraph . One may order the vertices of based on the right-most hyperedge containing them (with respect to ). Note that we can compute such an ordering in linear time from . Both orders together then form a doubly lexically order and allow to construct a -free matrix for . Note that Algorithm 3 and the algorithm described in Theorem 4.2 only have a logarithmic overhead in runtime because they compute a doubly lexically order. If such an order is given, both algorithm run in time.
For an alternative approach, we first determine for each vertex the index of the left-most hyperedge containing it (with respect to ). Let be that number, i. e., if is the left-most hyperedge containing , then . Next, we compute the separators between consecutive hyperedges (see Algorithm 1). Let denote the separator between and and let . Then, for each with , it holds that (i) if and only if and , and (ii) is an edge of the union join graph of if and only if . Running the same approach again using the reverse of therefore allows to compute the subset graph and union join graph in time.
Theorem 6.1
There is an algorithm that computes the union join graph and subset graph of a given interval hypergraph in time, respectively, where is the size of the computed graph.
Acknowledgements
We would like to thank Feodor F. Dragan and Rachel Walker for stimulating discussions.
References
- [1] Ausiello, G., D’Atri, A., Moscarini, M.: Chordality properties on graphs and minimal conceptual connections in semantic data models. Journal of Computer and System Sciences 33 (2), 179–202, 1986.
- [2] Bandelt, H.-J., Mulder, H.M., Distance-hereditary graphs. Journal of Combinatorial Theory, Series B 41, 182–208, 1986.
- [3] Beeri, C., Fagin, R., Maier, D., Yannakakis, M.: On the Desirability of Acyclic Database Schemes. In: Journal of the ACM 30, 479–513, 1983.
- [4] Berge, C.: Hypergraphs: Combinatorics of Finite Sets. Elsevier Publishing Co., North-Holland, 1989.
- [5] Berry, A., Simonet, G.: Computing the atom graph of a graph and the union join graph of a hypergraph. CoRR abs/1607.02911, 2016.
- [6] Borassi, M., Crescenzi, P., Habib, M.: Into the Square: On the Complexity of Some Quadratic-time Solvable Problems. Electronic Notes in Theoretical Computer Science 322, 51–67, 2016.
- [7] Brandstädt, A., Dragan, F.F.: Tree-Structured Graphs. In Thulasiraman, K., Arumugam, S., Brandstädt, A., Nishizeki, T. (Eds.): Handbook of Graph Theory, Combinatorial Optimization, and Algorithms, 751–826, CRC Press, 2015.
- [8] Brandstädt, A., Dragan, F.F., Chepoi, V., Voloshin, V.I.: Dually Chordal Graphs. SIAM Journal on Discrete Mathematics 11 (3), 437–455, 1998.
- [9] Damiand, G., Habib, M., Paul, C., A simple paradigm for graph recognition: application to cographs and distance hereditary graphs. Theoretical Computer Science 263 (1-2), 99–111, 2001.
- [10] D’Atri, A., Moscarini, M.: Distance-hereditary graphs, Steiner trees, and connected domination. SIAM Journal of Computing 17 (3), 521–538, 1988.
- [11] D’Atri, A., Moscarini, M.: On hypergraph acyclicity and graph chordality. Information Processing Letters 29, 271–274, 1988.
- [12] Dourisboure, Y.: Compact Routing Schemes for Generalised Chordal Graphs. Journal of Graph Algorithms and Applications 9 (2), 277–297, 2005.
- [13] Dourisboure, Y., Dragan, F.F., Gavoille, C., Yan, C.: Spanners for bounded tree-length graphs. Theoretical Computer Science 383 (1), 34–44, 2007.
- [14] Dragan, F.F., Köhler, E.: An Approximation Algorithm for the Tree t-Spanner Problem on Unweighted Graphs via Generalized Chordal Graphs. Algorithmica 69 (4), 884–905, 2014.
- [15] Elmasry, A.: Computing the subset partial order for dense families of sets. Information Processing Letters 109, 1082–1086, 2009.
- [16] Fagin, R.: Degrees of Acyclicity for hypergraphs and relational database schemes. Journal of the ACM 30, 514–550, 1983.
- [17] Galinier, P., Habib, M., Paul, C.: Chordal Graphs and Their Clique Graphs. WG 1995, Lecture Notes in Computer Science 1017, 358–371, 1995.
- [18] Gavril, F.: The intersection graphs of subtrees in trees are exactly the chordal graphs. Journal of Combinatorial Theory, Series B 16 (1), 47–56, 1974.
- [19] Habib, M., McConnell, R., Paul, C., Viennot, L.: Lex-BFS and partition refinement, with applications to transitive orientation, interval graph recognition and consecutive ones testing. Theoretical Computer Science 234 (1–2), 59–84, 2000.
- [20] Habib, M., Stacho, J.: Reduced clique graphs of chordal graphs. European Journal of Combinatorics 33 (5), 712–735, 2012.
- [21] Kaba, B., Pinet, N., Lelandais, G., and Berry, B.: Clustering gene expression data using graph separators. In Silico Biology 7 (0031), 2007.
- [22] Kumar, T.V.V., Shridhar, A., Ghoshal, A.: Computing full disjunction using COJO. Information Technology and Management 10 (1), 3–20, 2009.
- [23] Leimer, H.-G.: Optimal decomposition by clique separators. Discrete Mathematics 113 (1–3), 99–123, 1993.
- [24] Paige, R., Tarjan, R.E.: Three Partition Refinement Algorithms. SIAM Journal of Computing 16 (6), 973–989, 1987.
- [25] Pritchard, p.: Opportunistic algorithms for eliminating supersets. ActaInformatica 28, 733–754, 1991.
- [26] Pritchard, P.: On Computing the Subset Graph of a Collection of Sets. Journal of Algorithms 33 (2), 187–203, 1999.
- [27] Tarjan, R.E., Yannakakis, M.: Simple Linear-Time Algorithms to Test Chordality of Graphs, Test Acyclicity of Hypergraphs, and Selectively Reduce Acyclic Hypergraphs. SIAM Journal of Computing 13 (3), 566–579, 1984.
- [28] Uehara, R., Uno, Y.: Laminar structure of ptolemaic graphs with applications. Discrete Applied Mathematics 157, 1533–1543, 2009.