Manuscript Offprint
arXiv:2610.11385Tight bounds and output sensitive algorithms for maximal clique enumeration in link streams
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Given a link stream, we are interested in the question of finding all its maximal cliques. A link stream is a set of interactions between pairs of vertices, each one lasting during some time interval, and a clique of a link stream is a set of vertices together with a time interval during which all of them interact. A clique is maximal if neither its vertex set nor its interval can be enlarged. This question models the detection of groups in temporal data and has been studied for about ten years, and several algorithms list maximal cliques efficiently in practice. All known algorithms may however spend time exponential in the size of a clique for each clique they output, and the best known bounds on the number of maximal cliques carry a factor exponential in the degeneracy of the instantaneous graphs that is larger than in static graphs. Here, we approach the question under the light of two parameters of the instantaneous graphs of the stream, their maximum degree and their degeneracy . We first prove that a link stream with links has maximal cliques, and that a link stream with vertices and distinct end times has maximal cliques. Both bounds are tight up to a factor polynomial in and respectively, and the second one improves the factor of previous bounds to . We also show that no bound of the form can hold. Then we present two output sensitive algorithms. The first one has setup time and polynomial time delay poly( ) . The second one has setup time and polynomial time delay poly( ) , and does not depend on the maximum degree. To the best of our knowledge, these are the first algorithms with polynomial time delay for this problem, in general link streams with durations and with both the vertex set and the interval maximal. Finally, we show that an online version of the second algorithm outputs every maximal clique at its end time in total time , where is the number of maximal cliques, and that all our results apply to the -cliques of temporal graphs. Our tools are a threshold characterization of maximal cliques, the decomposition by degeneracy orderings used for static graphs, a suffix argument that decides maximality without inspecting the neighborhood of a vertex, and dynamic orientations of graphs of bounded arboricity.
Keywords: enumeration, algorithms, maximal cliques, link streams, temporal graphs, k-degenerate graphs.
1 Introduction
Many data sets record interactions between entities together with the moment at which they happen and the time during which they last. For instance, phone calls, face-to-face contacts measured by sensors, messages, or co-presence in a place. Such data are naturally modeled by link streams, also called temporal graphs or temporal networks [39, 19, 50, 43]. Some of these formalisms use discrete time steps and instantaneous interactions, others continuous time and interactions with durations. Many problems which are polynomial on static graphs become NP-hard in the temporal setting, even on very restricted inputs, and the thesis of Molter [51] gives a parameterized overview. We use link streams with durations [43, 65, 7], which contain the -cliques of discrete temporal graphs as a special case (Section 6). In a link stream, a link says that the vertices u and v interact during the time interval . At every time t, the links present at t form a static graph called the instantaneous graph at time t. Real link streams are often sparse in the sense that their instantaneous graphs have small maximum degree or small degeneracy, which is the smallest integer k such that every subgraph contains a vertex of degree at most k. For instance, Bentert et al. [9] measured a temporal version of the degeneracy on many real-world temporal graphs and observed that it is small, and Baudin et al. [7] observed that the maximum degree of the instantaneous graphs varies in a much smaller range than the number of vertices and links.
Groups of entities that all interact with each other during some period are a basic object of study in these data. Viard, Latapy and Magnien introduced the corresponding notion of clique [63, 64]. A clique of a link stream is a pair where is a set of at least two vertices and every pair of vertices of interacts during the whole interval . It is maximal if no vertex can be added to and if the interval cannot be extended. Maximal cliques have been used to reveal contact patterns among high-school students [63] and to define communities in link streams [6]. It thus seems interesting both from a practical and theoretical point of view to study the enumeration of maximal cliques in link streams, and to take into account the sparsity of their instantaneous graphs.
Maximal cliques in static graphs For static graphs, the question has been extensively studied and we can essentially distinguish between two families of algorithms. On one side, worst-case output size algorithms have been proposed. Their complexities match the maximum number of maximal cliques one can find in the considered graphs. For instance, Tomita et al. [60] propose an algorithm enumerating all maximal cliques of an n-order graph in time , which is optimal since the Moon–Moser graphs have maximal cliques [54]. Similarly, for k-degenerate graphs, Eppstein et al. [32] prove an bound on the number of maximal cliques, which is attained, and give an algorithm running in time , which is fast on large real-world graphs [33]. Both algorithms are based on the Bron–Kerbosch algorithm [15]. On the other side, output sensitive algorithms bound the time spent for each maximal clique by a polynomial in the parameters of the graph, and many of them have polynomial time delay, that is, the wait between the output of two maximal cliques is polynomial. Tsukiyama et al. [61] gave the first such algorithm, with delay , and Johnson et al. [41] showed how to list the maximal cliques in lexicographic order with polynomial delay. Chiba and Nishizeki [22] listed them in time per clique, where a is the arboricity. Makino and Uno [46] obtained a delay of order the fourth power of the maximum degree and, with fast matrix multiplication, ; Comin and Rizzi [25] improved the latter with rectangular matrix multiplication. Chang et al. [21] gave an output sensitive algorithm for sparse graphs analysed with the h-index of the graph, and Conte et al. [26] obtained a delay depending on the degeneracy, the maximum degree and the maximum clique size, in space linear in the graph. Conte and Tomita showed that the delay of the Bron–Kerbosch algorithm with pivoting can be exponential [27]. The author proposed a decomposition of a k-degenerate graph into n subgraphs of at most vertices which yields an enumeration time depending only on the degeneracy [47]. A clique which is maximal in a subgraph but not in the graph is a proper suffix of a maximal clique found before, so that such cliques can be rejected with a generalized suffix tree; we use the same observation in Section 5. A delay depending only on the degeneracy can then be obtained by buffering the solutions [48]. Several of these algorithms, and ours, first guarantee a bound on the time needed to produce the first i solutions, for every i, and then turn it into a delay bound by buffering solutions in a queue. This technique goes back to Uno [62]. Capelli and Strozecki analysed it and gave a geometric amortization scheme which achieves a similar delay, up to a logarithmic factor, in polynomial space [17, 18]. Related enumeration problems include k-plexes [11, 40] and k-defective cliques [28, 40].
Maximal cliques in link streams The known results are summarized in Tables 1 and 2, and we present them in chronological order. Viard, Latapy and Magnien first defined -cliques in link streams in which interactions are instantaneous [63, 64]. In a -clique , every pair of vertices of X interacts at least once in every subinterval of of length . We keep the name -clique used in the literature, but we denote by the length of these subintervals, since denotes the maximum degree in this paper. Viard et al. gave an algorithm which grows cliques in time and in vertices from each link, in time exponential in [64], and they then extended it to links with durations [65].
Himmel et al. [37, 38] adapted the Bron–Kerbosch algorithm with pivoting to -cliques. They introduced the -slice degeneracy, which is the largest degeneracy of the graphs formed by the interactions of a window of length , and showed that the problem is fixed-parameter tractable with respect to this parameter. The running time of their algorithm is bounded in terms of the number of time-maximal cliques, which are the cliques whose interval cannot be extended but whose vertex set might be. The effect of pivoting on the worst-case running time was left open. Bentert et al. [8, 9] extended this algorithm to -k-plexes. For cliques, they bounded the number of time-maximal cliques by , where is the -slice degeneracy and the number of time steps. We use the letter for the -slice degeneracy since, by Section 6, it is the largest degeneracy of the instantaneous graphs of a link stream associated with the temporal graph. This improves the bound of [38]. These results are presented together in the thesis of Molter [51]. Molter et al. studied isolated temporal cliques, which have few links to the rest of the stream, and gave fixed-parameter algorithms with respect to the isolation parameter [52, 53]. They note that their algorithm is not output sensitive.
Banerjee and Pal required every pair to interact at least times in every window of length . They gave an algorithm listing the maximal -cliques in time [1], then a two-phase algorithm which first stretches cliques of two vertices in time and then adds vertices [2, 4], and an incremental algorithm [3]. Pal adapted the algorithm of Himmel et al. to -cliques, with running time , where and are the numbers of vertices and edges and is the -slice degeneracy, which ignores [56]. Boekhout and Takes extended the two-phase approach to weighted temporal networks, in which bounds the total weight of the interactions of a pair in a window [13]. They perform the first phase in time instead of , and their algorithm is much faster in practice. They also require the interval of a clique to start and end with an interaction between two of its vertices, which changes the set of maximal cliques.
Baudin et al. [7, 5] gave an algorithm which, for every time at which a link starts, lists the cliques of the instantaneous graph at which contain this link, and keeps those which are vertex-maximal. It handles link streams with more than links. Its running time is , where and are the largest maximum degree and clique size of an instantaneous graph. Its output sensitive running time is , where is the number of maximal cliques and the proportion of leaves of the search tree which output a maximal clique. The authors show that and that can occur without pivoting, while with their pivot is below 2 in their experiments. The thesis of Baudin [5] states the understanding of this factor as a perspective.
Davot et al. [30] consider the same maximal -cliques as we do, in temporal graphs which satisfy two assumptions. The first one is a temporal version of the closure of static graphs: two vertices with at least common neighbors during a short interval of time are adjacent around that time. The second one is that the neighborhood of every vertex changes by at most vertices between two consecutive time steps. They prove that the number of maximal -cliques is then at most , where is the length of the short intervals, and they list them with the algorithm of [38]. Their parameters and the degeneracy are incomparable. For instance, a complete graph present at every time step has closure number 1 and degeneracy
, while has degeneracy 2 and closure number . Observe that their bound also bounds the number of maximal cliques output by our algorithms on these temporal graphs. Finally, a bound in terms of the vertex deletion distance to order preservation is implicit in the work of Hermelin et al. [36], as observed in [30].
To summarize, the analyses of [38, 9, 7] bound the work by the number of time-maximal cliques, and this number can exceed the number of maximal cliques by a factor exponential in the size of a clique. As a consequence, none of these algorithms is known to spend time polynomial in the input for each maximal clique it outputs. Moreover, the best known bound on the number of maximal cliques [9] carries a factor , while in static graphs the corresponding factor is [32].
Cliques maximal over the whole lifespan Brunelli et al. [16] recently gave an output sensitive algorithm for another notion of maximal clique. For them, a temporal clique is a set of vertices which is a clique of some instantaneous graph, and it is maximal if no strict superset of it is a clique of some instantaneous graph. Their solutions are thus vertex sets, without time interval. This family of sets is hereditary, which allows them to use the framework of Cohen et al. [23]. They consider single-interval temporal graphs, in which every pair interacts during at most one interval of time. In such a graph with vertices and edges, they list the maximal temporal cliques in time and space , where is the maximum size of a temporal clique and the maximum degree of the graph of all the pairs which interact. They also list the first of them in time , using space .
The two problems are related as follows. If is a solution of [16], then together with the interval during which it is a clique is a maximal clique in our sense. Thus . The converse does not hold. For instance, in Figure 1, is a maximal clique although is contained in the clique . Moreover, can be exponentially larger than . Let and consider the complete -partite graph whose parts have three vertices each. Give every edge of this graph the link , and every pair inside a part the link . Then the only solution of [16] is the whole vertex set, while the link stream has maximal cliques. This example is the one used in [16] to compare their solutions with the maximal cliques of the instantaneous graphs. Therefore neither result implies the other. Observe also that, in our sense, the maximality of a clique only depends on the links present during its interval. On the contrary, a set of vertices which interacts during a long period is not a solution of [16] as soon as a larger set interacts once at some other time. Finally, the reduction from -cliques given in [16] produces temporal graphs in which a pair may interact during several intervals, to which their algorithm does not directly apply.
Other dense structures have been studied in temporal graphs. Qin et al. studied periodic cliques, whose edges reappear at regular intervals [57], and Zhu et al. listed sets of k time intervals that pairwise overlap within a query window, which they call temporal k-cliques [68]. Temporal cores [66], span-cores [34], persistent communities [44] and bursting cores [58] have also been considered, and Zhao et al. listed the maximal -bicliques of temporal bipartite graphs [67]. The name temporal clique is also used for a temporal graph whose underlying graph is complete, in the study of temporal spanners [20], which is a different object.
Related questions A different problem is to maintain the set of maximal cliques of a graph under edge insertions and deletions. Stix [59] and Ottosen and Vomlel [55] gave update algorithms, and Das et al. gave the first change-sensitive algorithms, whose time is proportional to the number of maximal cliques that appear or disappear, together with nearly tight bounds on this number [29]. Baudin et al. note that this approach can be adapted to link streams [7]. Observe however that the maximal cliques of a link stream are not the maximal cliques of its instantaneous graphs, since a vertex adjacent to all the vertices of a clique during part of its interval does not extend it. Inside one end time, our algorithms solve a problem of this incre-mental kind on a graph with or vertices. We will also need to maintain orientations of the instantaneous graphs. An orientation has out-degree at most c if every vertex has at most c out-neighbors, and an acyclic orientation of out-degree at most k exists if and only if the degeneracy is at most k. Brodal and Fagerberg maintained an orientation of out-degree under edge insertions and deletions, where a bounds the arboricity [14], Kopelowitz et al. obtained worst-case update times [42], and Christiansen and Rotenberg obtained out-degree [24]. These orientations need not be acyclic. The level data structures of Bhattacharya et al. [12] and Henzinger et al. [35] give acyclic orientations of out-degree , where a is the current arboricity, with polylogarithmic amortized update time; Liu et al. stated this orientation explicitly [45].
Our contributions Let be a link stream with vertices and links, let be the set of distinct end times of its links, and let , and be the largest maximum degree, the largest degeneracy and the largest clique size of an instantaneous graph. We first prove that a maximal clique ending at time is determined by its start time and by a maximal clique of a static graph whose edges are the pairs that interact throughout . As increases, these graphs only gain edges. Therefore, all maximal cliques ending at can be found by sweeping over the start times of the links present at , and by listing only maximal cliques of static graphs. This is what removes the factor exponential in the clique size of the previous algorithms.
Using this observation, we present a first output sensitive algorithm, which anchors every maximal clique at one of its links that ends at the end time of the clique. It has setup time , amortized time delay , where is the delay of maximal clique enumeration in an h-order graph, and polynomial time delay . For example, using the algorithm of Tsukiyama et al. [61], the delay is . As a by-product, we prove that a link stream has maximal cliques, and that this bound is tight up to a factor . An online version of the algorithm outputs every maximal clique at its end time.
In a second part, we consider the degeneracy. We first observe that the number of maximal cliques cannot be bounded by times a function of , since it can be quadratic in when . We then prove that a link stream has maximal cliques and that this is tight up to a factor polynomial in . This improves the factor of the bound of [9], and the factor of the bound of [38], to , which cannot be improved. We then present a second output sensitive algorithm, which anchors every maximal clique at its end time and at its first vertex in an ordering of the instantaneous graph in which every vertex has few later neighbors, as in the decomposition of [47]. A candidate found in the neighborhood of an anchor may fail to be maximal because of a vertex that comes earlier in the ordering. We show that such a candidate is a proper suffix of a maximal clique that has already been output, so that it can be rejected by a dictionary lookup, without inspecting the neighborhood of the anchor. Finally, we maintain the orderings over time with the level data structures of [12, 35]. The resulting algorithm has setup time and polynomial time delay , which does not depend on the maximum degree. It can also be run online, in which case it outputs every maximal clique at its end time in total time , where is the number of maximal cliques. When the output dominates the setup phase, its worst-case running time matches the largest possible number of maximal cliques up to a factor poly. All our results apply to the -cliques of temporal graphs, with equal to their -slice degeneracy. To the best of our knowledge, these are the first algorithms with polynomial time delay for listing the maximal cliques of link streams, in which both the vertex set and the interval are maximal. This problem differs from the enumeration of the vertex sets which are maximal over all times [16], and from enumeration under closure and stability assumptions [30].
The organization of the document is as follows. In Section 2, we introduce some notations and definitions. In Section 3, we prove basic results. These results are used in Sections 4 and 5.
for the proofs of the main contributions of the paper. The first algorithm and the bounds in terms of the maximum degree are presented in Theorems 1, 2 and 3. The bounds in terms of the degeneracy are proved in Theorem 6, and the second algorithm in Theorems 4, 5, 7 and 8. In Section 6, we apply our results to -cliques. We conclude in Section 7.
A graph is k-degenerate if there is an ordering of its vertices in which every vertex has at most neighbors in , and its degeneracy is the smallest such . Such an ordering is called a degeneracy ordering and can be computed in linear time [49]. Given an ordering of the vertices, is the rank of the vertex (the index of its position) in .
In our algorithms, we will need to consider the vertices of some cliques as strings. A string s is a suffix of a string t if there exists a string u such that . If u is not empty, s is called a proper suffix of t.
Definition 1. A link stream is a triple where is an interval, is a finite set of vertices and is a finite set of links with , and . The pair , written , is unordered.
As in [7], we assume that the link stream is simple, that is, two links of the same pair have disjoint intervals. Links of the same pair whose intervals intersect can always be merged into one link, since this does not change the times at which the pair interacts. In a simple link stream, a pair interacts at every time of an interval if and only if one of its links contains this interval. We also assume that there are no isolated vertices, so that .
Definition 2. For a time , the instantaneous graph has vertex set and an edge whenever some link satisfies . For an interval , the graph has vertex set and an edge whenever some link of contains .
If uv is an edge of , the link of uv containing t is unique since the stream is simple, and we denote its start and its end by and .
Definition 3. A clique of is a pair with such that is a clique of . A clique is maximal if there is no other clique with and .
This is equivalent to requiring that the interval cannot be extended and that no vertex can be added, which are called time-maximality and vertex-maximality in [7]. We denote by the number of maximal cliques of , by the set of distinct end times of links, and, for , by the set of pairs having a link that ends at , called the ending pairs at . We let , and be the largest maximum degree, the largest degeneracy and the largest clique size of a graph , . These maxima are taken over finitely many graphs, since only changes at the start and end times of links, and .
We use the RAM model, and an algorithm must output every solution explicitly. As in [47], the time complexity of an enumeration algorithm is divided into a setup phase followed by an enumeration phase. Let be the solutions in the order in which they are output, let be the number of steps performed after the setup phase and before is output, for , and let be the number of steps performed after the setup phase until the algorithm stops. Set . The algorithm has time delay if for all , and amortized time delay if for all , following [17]. The next lemma is folklore; it goes back to Uno [62] and is analysed in [17].
Lemma 1. An algorithm with amortized time delay p whose solutions have size at most p, where p is known at the end of the setup phase, can be turned into an algorithm with time delay which outputs the same solutions after the same setup phase. The new algorithm may require space proportional to the total size of the solutions.
We will obtain amortized time delays with the following lemma. An algorithm examines a sequence of candidates; some of them are output and the others are rejected. A charging map sends every candidate to a solution.
Lemma 2. Assume that, after its setup phase, an algorithm examines candidates and that there are integers and such that (i) at most steps are performed before the first candidate is examined, between two consecutive candidates, and after the last one; (ii) every candidate is sent by a charging map to a solution that is output when this candidate is examined or before; (iii) at most candidates are sent to each solution. Then the algorithm has amortized time delay .
Proof. Let . By (ii), every candidate examined until is output is sent to one of . By (iii), this implies that there are at most such candidates, and thus by (i). In the same way, the total number of candidates is at most , and thus .
3 Basic results
We want to show in this section that, roughly, a maximal clique of a link stream is determined by its end time, by its start time, and by a maximal clique of a static graph. Let be a clique of with . We define the start and the end of at time as
Lemma 3. Let be a clique of with and let with . Then is a clique of if and only if .
Proof. Let be distinct. A link of that contains contains . Since the stream is simple, this implies that it is the link of containing , whose interval is . Thus is an edge of if and only if , and the claim follows by considering all the pairs of .
Given a time and a threshold , Lemma 3 applied to pairs implies that the edges of are exactly the edges of with . Therefore, for , graph is obtained from by deleting edges. In other words, the graphs gain edges as increases.
Lemma 4. Let be a time, and with . Then is a maximal clique of if and only if is a maximal clique of , , and , that is, some pair of is an ending pair at . Conditions (b) and (c) are well defined under , since implies that is a clique of .
Proof. Assume first that is a maximal clique. Then is a clique of , hence of , and by Lemma 3, is a clique which contains . By maximality the two intervals are equal, which gives (b) and (c). If was not a maximal clique of , then

Figure 1: A link stream with one row per pair, in which each bar is a link. Its maximal cliques are ( ), ( ), ( ), ( ) and ( ). For , the link of bc ends at and the link of ac starts at , and C is a maximal clique of . The set is a maximal clique of with .
a larger clique of would give a clique containing , a contradiction. This gives (a).
Conversely, assume (a), (b) and (c). Then is a clique. Let be a clique with and . Observe that is a clique of and that . Thus Lemma 3 implies that , and therefore . This implies that is a clique of containing , and thus by (a).
Therefore, a maximal clique ending at is a clique of containing an ending pair, together with the threshold , such that is maximal in . Figure 1 gives an example.
Lemma 5. Let be a time, and , and let be a maximal clique of with . Then and is a maximal clique of .
Proof. Every pair xy of C is an edge of , so , which implies . Every pair xy of C also satisfies , so C is a clique of . Since this graph is obtained from by deleting edges, a clique of it which contains C is a clique of , and is thus equal to C.
4 Algorithms parameterized by the maximum degree
In this section we anchor every maximal clique at one of its links. We fix an arbitrary total order on the pairs of vertices. The canonical pair of a maximal clique is the smallest pair of which is an ending pair at ; it exists by Lemma 4(c). Its canonical link is the link of this pair which ends at .
Definition 4. Let be a link. The set is the set of common neighbors of and at time . The set is the set of values over the edges of with and . For , graph is the subgraph of induced by the common neighbors of and in .
Observe that , since . The outline of the first algorithm is the following. We consider every link , in increasing order of and then of the pair . For every threshold , in increasing order, we find all the maximal cliques of . For each of them, the set is a candidate. It is output with the interval if and if is its canonical pair, and rejected otherwise. The procedure is described in Algorithm 1.
Lemma 6. For every candidate examined for the link and the threshold , is a maximal clique of and is a maximal clique of .
Algorithm 1: Maximal cliques anchored at ending links
Data: A simple link stream .
Result: All the maximal cliques of .
1 Sort the links by end time and then by pair;
2 for every link in this order do
3 for every in increasing order do
4 for every maximal clique of (the empty set if has no vertex) do
5 ;
6 if and is the canonical pair of then
7 Output .
8 else
9 Reject it.
Proof. Since , the pair is an edge of , and thus is a clique of . Assume by contradiction that a vertex is adjacent in to all the vertices of . Then is a common neighbor of and in , hence a vertex of adjacent to all the vertices of . This contradicts the maximality of , and is a maximal clique of . By Lemma 5 with , it is also a maximal clique of . Moreover since the link of ends at , and Lemma 4 concludes.
Theorem 1. Given a simple link stream L, Algorithm 1 outputs exactly all its maximal cliques, without duplication.
Proof. An output satisfies , so it is a maximal clique by Lemma 6. Conversely, let be a maximal clique, with canonical pair and canonical link . Observe that . By Lemma 4, is the start of a link between two vertices of , and , so . The set is a clique of , and it is maximal in this graph because is a maximal clique of . Thus is examined as a candidate for and , it passes both tests, and is output. It is output only for its canonical link, for and for , and the maximal cliques of are found without duplication, so it is output exactly once.
Theorem 2. A link stream with m links in which every instantaneous graph has maximum degree at most has maximal cliques. Conversely, for all integers and , there is a link stream with and links, where , which has maximal cliques. When , this is .
Proof. By Theorem 1, every maximal clique is output by Algorithm 1 for some link , some and some maximal clique of . Observe that has at most vertices, so that , and that has at most vertices, so that it has at most maximal cliques. This gives the upper bound.
For the lower bound, let be the complete -partite graph whose parts have three vertices each. Its maximal cliques are its transversals, that is, the sets containing one vertex of every part. Take two more vertices and . Add the link for every edge of , and the links and for every vertex of . Finally, add the links for . There are links of the first kinds and links of . In every instantaneous graph, and have degree at most and the vertices of have degree , so that . For every transversal of and every , the set satisfies the three conditions of Lemma 4 for and . Indeed, and are given by the link of , and a vertex of outside belongs to the same part as a vertex of , and is thus not adjacent to it. This gives maximal cliques. There are no other maximal cliques ending at the times , since by Lemma 4 such a clique contains the ending pair and starts at . The maximal cliques ending at do not contain both and , and they are the cliques and . When , we have , and thus .
The proof gives the bound . When , the construction satisfies , and thus . The gap between the two bounds is therefore a factor . We now analyse the time complexity. In the rest of the paper, denotes the time delay, including the time to detect the end of the enumeration, of an algorithm listing the maximal cliques of an h-order graph given by its adjacency matrix. We have by [61], and after a preprocessing in time by [46], where is the exponent of matrix multiplication. We assume that is non-decreasing and that , which holds for these polynomial bounds.
Lemma 7. Send every candidate C of Algorithm 1, examined for a link and a threshold , to the maximal clique . Then every candidate is sent to a maximal clique which is output when the candidate is examined or before, and at most candidates are sent to each maximal clique.
Proof. By Lemma 6, is a maximal clique. Let be its canonical link and its canonical pair. The pair is an ending pair of at , so is not larger than , and is either equal to or considered before . If , then the maximal clique is output for and for the threshold . This threshold is considered before , or is equal to , in which case the candidate is the output itself. For the second claim, observe that a candidate sent to is determined by the pair , which is one of the at most pairs of , and by . Thus there are of them.
Theorem 3. Given a simple link stream, Algorithm 1 can be implemented with setup time and amortized time delay . It can also be implemented with the same setup time and polynomial time delay .
Proof. In the setup phase, we sort the links by end time and then by pair, and for every vertex x we build an interval tree on the links incident to x. Such a tree returns the links of x containing a time t in time , where h is the number of these links [10]. We also compute by sweeping the time and maintaining the degrees of the current instantaneous graph. This takes time in total.
When a link is considered, we query the trees of and to obtain and , together with the start times of the corresponding links, and we compute in time . Then we query the tree of every vertex of to obtain the edges of between vertices of together with their values , in time . We put the values of in a binary heap in time , so that every threshold is extracted in increasing order in time . For every , we build the adjacency matrix of in time and list its maximal cliques with time delay . The two tests of the algorithm take time per candidate.
Observe that every link and every threshold yield at least one candidate, since and since every graph, including the graph without vertex, has a maximal clique. Thus condition (i) of Lemma 2 holds with , and conditions (ii) and (iii) hold with by Lemma 7. Therefore, the algorithm has amortized time delay . The value of is not known after the setup phase, but , so the amortized time delay is also , which can be computed from and . Since a solution has at most vertices, Lemma 1 gives the time delay .
Observe that, when Algorithm 1 considers a link ending at , it only uses the links that start at or before. It can therefore be run online, sweeping the time with the three phases described in Section 5.4: at a time , the links starting at are inserted, then the links ending at are considered, and finally they are deleted. We store the current neighbors of every vertex, with the start times of the corresponding links, in a balanced search tree, and we compute the sets and the edges between their vertices with an array that marks the vertices of . In that case, every maximal clique is output at its end time, and the total time is . Note also that the algorithm of Baudin et al. [7] anchors every clique at a link starting at its start time and lists all the cliques of the instantaneous graph containing this link, which may cost a factor per maximal clique. Algorithm 1 only lists maximal cliques of the graphs , one threshold at a time, which replaces this factor by .
5 Algorithms parameterized by the degeneracy
The bounds of Section 4 depend on the maximum degree, which can be much larger than the degeneracy. We first observe that the number of maximal cliques cannot be bounded by the number of links times a function of the degeneracy.
Example 1. Let . Take the vertices , and , the links and for , and the links for . Every instantaneous graph is , possibly with the edge , so , and . By Lemma 4, is a maximal clique for all , so that .
The relevant quantity is therefore not m but the product of the number n of vertices and of the number of end times, as in the bounds of [38, 9].
5.1 Orders, anchors and suffixes
Definition 5. Assume that for every end time we are given a total order on . For a vertex , is the set of neighbors of in that have higher rank than in , and . For a set of vertices, is the vertex of with lowest rank in , and for , is the set of vertices of with rank at least . For a pair , the anchors of at are the vertices such that .
We denote by the largest size of a set . If is a degeneracy ordering of for every , then . Observe that every ending pair has at least one anchor, namely the vertex of lowest rank among and , since is an edge of . Ordering the vertices of a clique by increasing rank in , we will see cliques as strings; the set then corresponds to a suffix of the string of , which is proper if . For an anchor of , we call its window, we let , which is a clique of , we let be the set of values over the edges of with , and we let .
Lemma 8. Let be a clique of and . Then . In particular, .
Proof. Every vertex of distinct from is adjacent to in and has higher rank than in .
The next lemma is the counterpart, for link streams, of Corollary 2 of [47]. It is illustrated in Figure 2.
Lemma 9. Let , and , and let be a maximal clique of such that , and . If is not a maximal clique of , then there is a maximal clique of such that has lower rank than in and . In particular, the string of is a proper suffix of the string of .
window
: a maximal clique of , output at its first vertex
z
w
x
y
: a candidate at the anchor w, rejected since
Figure 2: Lemma 9. A vertex extending a candidate found in the window of has lower rank than . The maximal clique containing is output at an earlier anchor, and is its suffix starting at .
Proof. Let be adjacent in to all the vertices of . Assume by contradiction that has higher rank than in . Since is adjacent to in , this implies that , and thus that is a clique of , which contradicts the maximality of . Therefore has lower rank than .
Let be a maximal clique of containing . Every pair of is an edge of , so , and since . Thus . Similarly, since every pair of is an edge of , and , so that . By Lemma 4, is a maximal clique of . Observe that first has rank at most .
Finally, by Lemma 8, and is a clique of , hence of . It contains , since every vertex of belongs to and has thus rank at least . By maximality of in , this implies that .
5.2 The algorithm for given orders
The outline of the second algorithm is the following. We consider the end times in increasing order. For every end time , we consider the ending pairs in increasing order, the anchors of each pair by increasing rank in , and the thresholds in increasing order. For each of them, we find all the maximal cliques of which contain . Such a candidate is output if it passes three tests. The first two are those of Algorithm 1. For the third one, we use a dictionary of pairs , emptied at every end time, in which we insert the proper suffixes of the maximal cliques that are output, and a candidate is rejected if it is found in . The procedure is described in Algorithm 2.
The maximal cliques of which contain are the sets where is a maximal clique of the subgraph of induced by the common neighbors of the vertices of ; this subgraph has at most vertices. Observe that is a clique of when . In the following, a candidate is a tuple examined by the innermost loop.
Lemma 10. Whenever a candidate is examined, for every element of , is a proper subset of a clique of such that has been output, where is the current end time. In particular, is not a maximal clique of .
Proof. An element is inserted when is output, and is then a clique of . Since , the set does not contain and is a proper subset of . Since is a clique of , is not a maximal clique of this graph.
Lemma 11. Let be a maximal clique of , let be its canonical pair and let . Then Algorithm 2 outputs when it considers the pair , the anchor and the threshold , and does not output it at any other moment.
Algorithm 2: Maximal cliques anchored at vertices
Data: A simple link stream and an order for every .
Result: All the maximal cliques of .
1 for every in increasing order do
2 Initialize an empty dictionary;
3 for every pair in increasing order do
4 for every anchor of at , by increasing rank in do
5 ;
6 for every with , in increasing order do
7 for every maximal clique of which contains do
8 if or is not the smallest pair of in or then
9 Reject it.
10 else
11 Insert in for every ;
12 Output .
Proof. By Lemma 8, , so is an anchor of and . By Lemma 4, . This implies that and . Lemma 4 also implies that is a maximal clique of , hence of . Thus is a candidate. It satisfies , its pair is canonical, and by Lemma 10. Therefore it is output.
Conversely, if is output for the pair and the anchor , then , so . The second test forces to be the canonical pair, and the threshold is . Since the maximal cliques of are found without duplication, is output only once.
Theorem 4. Given a simple link stream and an order for every , Algorithm 2 outputs exactly all the maximal cliques of , without duplication.
Proof. By Lemma 11, every maximal clique is output exactly once. It remains to prove that every output is a maximal clique. Let be output for the pair and the anchor . Then is a maximal clique of containing , , and since . By Lemma 4, it suffices to show that is a maximal clique of . Assume by contradiction that it is not. By Lemma 9, there is a maximal clique with such that has lower rank than . Let be the canonical pair of . Since , the pair is not larger than . By Lemma 11, is output when the pair is and the anchor is . If is smaller than , this happens before the pair is considered. Otherwise , and is an anchor of considered before . In both cases, since , the element was inserted in before was examined, and was rejected, a contradiction.
Lemma 12. For every candidate , let . If is a maximal clique of , send the candidate to . Otherwise, send it to a maximal clique given by Lemma 9, chosen once and for all if there are several. Then every candidate is sent to a maximal clique which is output when the candidate is examined or before, and at most candidates are sent to each maximal clique.
Proof. By Lemma 5, is a maximal clique of with , and . Thus the image is well defined. It is , which is then a maximal clique by Lemma 4, or with and first of lower rank than . In both cases, the image is for a set with , where in the first case.
Let and let be the canonical pair of . By Lemma 11, the image is output for the pair , the anchor and the threshold . Since , the pair is not larger than . If it is smaller, the image is output before the candidate is examined. Assume now that . If has lower rank than , the image is output while an earlier anchor of is considered. Otherwise , which implies that , and the image is output at the threshold . If this happens before. If , the candidate passes the first two tests and, by Lemma 10, the third one, so that it is the output itself.
For the second claim, observe that a candidate sent to is determined by the vertex , which determines , by the pair xy, which is one of the pairs of C, and by , which has at most elements.
Theorem 5. Assume that, for every and every pair , the anchors of xy at e can be listed by increasing rank in with time delay A, that can be computed and sorted by rank in in time , and that the values of the edges inside can be computed in time . Then Algorithm 2 has amortized time delay .
Proof. Observe first that every ending pair has an anchor, that every anchor yields the threshold , and that every threshold yields at least one candidate, since is contained in a maximal clique of . Therefore, between two consecutive candidates, the algorithm moves to the next end time, pair, anchor or threshold, and computes a window and the values inside it in time . It puts the values of in a binary heap in time and extracts the next one in time . Then it builds the adjacency matrix of in time , and finds the next maximal clique in time . Sorting the vertices of a candidate by rank and the first two tests take time , since . We store as a balanced search tree indexed by , whose entries are tries, every node keeping its children in a balanced search tree. Let be an output, ordered by increasing rank. The strings of its proper suffixes , read backwards, are exactly the prefixes of the string . We therefore insert this single string in the trie of , every node of the trie representing an element of , and a candidate is in if and only if its string read backwards is the label of a path from the root of the trie of its threshold. A search and the insertions of an output then take time , since the thresholds at a time are start times of links present at , and they add nodes. At a new end time, a new empty dictionary is created in constant time, and the previous one remains allocated, so that the space used by is proportional to the total size of the outputs. Lemma 2 and Lemma 12 conclude.
5.3 The number of maximal cliques
Theorem 6. A link stream with vertices, distinct end times and -degenerate instantaneous graphs has maximal cliques. More precisely, it has maximal cliques, where is the number of non-isolated vertices of . Conversely, for all integers and , there is a link stream with , and which has maximal cliques. When , this is .
Proof. For the upper bound, choose for every a degeneracy ordering of , so that . By Lemma 11, every maximal clique is determined by , by , by , and by , which is a maximal clique of the subgraph of induced by the neighbors of in . This subgraph has at most vertices, so it has at most maximal cliques, and . The vertex is an anchor, hence a non-isolated vertex of . Summing over the end times and the non-isolated vertices of gives the bounds.
For the lower bound, take the link stream of the proof of Theorem 2, and add an independent set of vertices. For every , add the links for every vertex of and for . The end times are and . In every instantaneous graph, a vertex of has degree and the graph obtained by removing has vertices, so that the degeneracy is at most . When is present, the vertices of have degree , and and have degree , so that the minimum degree is and . Let , and let be a transversal of . The set satisfies the conditions of Lemma 4 for and . Indeed, a vertex outside either belongs to , and is then not adjacent to , or belongs to the same part of as a vertex of , and is then not adjacent to it. This gives maximal cliques. As in the proof of Theorem 2, the other maximal cliques are the cliques and . When , we have and , so that .
The proof also gives the more local bound , where is the set of anchors at for a degeneracy ordering of , and is taken at time . When , the construction satisfies and , and thus . The gap between the two bounds of Theorem 6 is therefore a factor . Observe that Theorems 2 and 6 are incomparable. In Example 1, and . Conversely, take disjoint pairs which interact during , and links of another pair which end at distinct times. Then and , while .
5.4 Maintaining the orders over time
It remains to provide orders with small out-degree, and the operations required by Theorem 5, without computing a degeneracy ordering at every end time, which could cost time per end time. We sweep the time and maintain the instantaneous graph under insertions and deletions of edges. To respect closed intervals, the events at a time are processed in three phases. First the links starting at are inserted, then the end time is processed if , and finally the links ending at are deleted. Every link causes one insertion and one deletion. We use the following data structure.
Lemma 13 ([12], [35, Section 2 and Lemma 7], see also [45, Corollary 3.3]). There is a data structure which maintains, under insertions and deletions of edges in a graph on n vertices, a level for every vertex such that the following holds. Orienting every edge from the lower to the higher level, and from the smaller to the larger index between vertices of the same level, gives an acyclic orientation in which every out-degree is , where a is the arboricity of the current graph. The data structure is deterministic, and the amortized time, the amortized number of level changes and the amortized number of reoriented edges per update are .
In [35], the edges between two vertices of the same level are oriented arbitrarily, and every vertex has neighbors at its level or at higher levels. Thus orienting them by index keeps the out-degrees in and makes the orientation acyclic. When a vertex changes level, the edges whose orientation changes join it to neighbors whose level is at least the smaller of its old and new levels. The data structure of [35] scans these neighbors during the move, so that these reorientations are paid for by the bounds of [35]. Liu et al. state this acyclic orientation explicitly for their parallel version [45]. The out-degree bound holds between two updates, and may be violated while the levels are being updated. Since the arboricity is at most the degeneracy, the out-degrees are . We let be the order of the vertices by level at time and then by index. Then the orientation of given by Lemma 13 is the orientation along , and . In addition, we maintain for every pair the set of the vertices such that , where denotes the current out-neighborhood of . The anchors of an ending pair at are the vertex of lowest rank among and and the vertices of .
Theorem 7. The maximal cliques of a simple link stream can be enumerated online, every maximal clique being output at its end time, in total time .
Proof. We sort the events in time , which is not needed if they are given in chronological order. We maintain the data structure of Lemma 13, the current links in a balanced search tree indexed by pairs, and the nonempty sets in a balanced search tree indexed by pairs, each of them stored as a balanced search tree. We update the sets once per insertion or deletion of an edge, after the data structure of Lemma 13 has been updated, so that the out-degrees are before and after the update. For every vertex whose out-neighborhood has changed, we compare its old and new out-neighborhoods. For every vertex which has left , we remove from the sets for in the old out-neighborhood of , and for every vertex which has entered , we add to the sets for in the new out-neighborhood of . This takes time per change, since the out-degrees are before and after the update. The number of such changes is at most the number of reoriented, inserted and deleted edges. By Lemma 13, the maintenance takes total time .
At an end time , for every ending pair , we sort its anchors by level and index, in time for anchors. Every anchor yields at least one candidate. The window of an anchor is its current out-neighborhood, and the values inside it are read in the tree of current links in time . The rest of the work is accounted for as in the proof of Theorem 5, with a cost per anchor instead of . By Lemma 12, there are candidates, with . Summing gives the bound. Observe finally that every maximal clique ending at is output while is processed.
The sweep does not give a bound on the time delay, since many links may be inserted before the first end time, and this work cannot be charged to the outputs that come before it. We therefore perform the sweep during the setup phase, record the history of the data structure, and answer the queries of every end time from this history.
Theorem 8. Given a simple link stream, Algorithm 2 can be implemented with polynomial time delay , after a setup phase in time . It requires space, besides the space used by the dictionary and by Lemma 1.
Proof. During the setup phase, we run the sweep of Theorem 7 without enumerating, and we make the following structures persistent with the path-copying technique of Driscoll et al. [31]. For every tree, we record the list of its versions together with the time and the phase of the event that created them. Every set is stored as a balanced search tree ordered by level and then by index, and the out-neighborhood of every vertex is stored as a balanced search tree ordered by index, so that a change of level of a vertex does not modify the out-neighborhoods that contain it. As in the proof of Theorem 7, these trees are updated once per insertion or deletion of an edge, after the data structure of Lemma 13 has been updated. An update of a persistent balanced search tree takes time and space . The keys of the trees are stored values: a vertex w is inserted with the pair formed by its level at that moment and its index, so that the old versions are never modified. When the level or the out-neighborhood of w changes, we remove the entries of w, with their old keys, from the trees with x, y in the old out-neighborhood of w, and we insert them, with their new keys, in the trees with x, y in the new out-neighborhood of w. Since the out-degrees are before and after every update, this costs updates of persistent trees per level change and per reoriented, inserted or deleted edge. By Lemma 13, the number of level changes and of reoriented edges is . Thus the setup phase performs updates of persistent trees, in time and space . We also record, for every vertex, the sequence of its levels with the times of the changes, and the largest out-degree c reached when an end time is processed. The bound on the out-degrees, which holds after every update, is used for the maintenance, and c is only used to set the delay. Finally, we sort the links by end time and by pair, and we store, for every pair, its links sorted by start time, in time .
During the enumeration phase, for an end time e and an ending pair xy, we find by binary search the versions current at e, that is, the versions reached after the insertions at e and before the deletions at , in time , using . We list the anchors of by an in-order traversal of the version of , merged with the vertex of lowest rank among and , whose levels at time are found by binary search. This has time delay . For an anchor , we read the version of in time . We sort it by rank after finding the levels of its vertices at time by binary search, in time . Then we find the value of every edge inside by binary search in the links of the pair, in time . Theorem 5 with gives an amortized time delay . Since , this is also , which is known at the end of the setup phase. Since every solution has at most vertices, Lemma 1 gives the time delay .
We conclude this section with three observations. First, does not depend on the orders used by the algorithm. Thus, by Theorem 6, the total running time of the algorithms of Theorems 7 and 8 is , which matches the lower bound of Theorem 6 up to a factor when the output dominates the setup phase. Second, a static graph can be seen as the link stream with a link for every edge , whose maximal cliques are the pairs for the maximal cliques of with at least two vertices. With a degeneracy ordering, Algorithm 2 then reduces to the algorithm of [47], with the generalized suffix tree replaced by the dictionary , and Theorem 5, with the sets computed in time , gives an amortized time delay polynomial in the degeneracy, as in [48]. Third, the dictionary and Lemma 1 may require exponential space. As in Theorem 3 of [47], can be avoided by testing the maximality of a candidate directly, scanning the neighbors of the anchor in that have lower rank, in time . This reintroduces the maximum degree. Using the geometric amortization of [17] instead of Lemma 1, this gives a time delay in space polynomial in the input, where by Theorem 6.
6 Application to -cliques
A temporal graph is given by a set of time-edges , with integer times . As in the introduction, we denote by the integer that defines -cliques, and we assume that , since otherwise there is no -clique. We use the discrete definition of [38], which differs from the original definition of [64] in that time is discrete. A -clique is a pair with , integers and with and , such that for every integer and all distinct , there is a time-edge with . The -slice degeneracy of is the largest degeneracy of the graphs , for integers , whose edges are the pairs having a time-edge in [38].
For every pair , the integers such that has a time-edge in form a union of maximal sets of consecutive integers . We make each of them a link of a link stream . Every time-edge creates at most one such set and the sets are merged, so has at most links, and it is simple.
Lemma 14. The map is a bijection between the maximal -cliques of and the maximal cliques of . Moreover, the instantaneous graph of at an integer is .
Proof. A pair uv has a time-edge in for every integer if and only if these integers belong to one maximal set of consecutive integers of uv, that is, if and only if a link of uv in contains . Thus is a -clique if and only if is a clique of . The map preserves inclusion in both directions, so it sends the maximal -cliques to the cliques that are maximal among the cliques of with integer endpoints. Such a clique is maximal among all cliques. Indeed, if a clique contained it, every link of a pair of would contain and, having integer endpoints, also , so that would be a larger clique with integer endpoints. Conversely, the maximal cliques of have integer endpoints by Lemma 4. The last claim is the definition of .
For an integer , the graph is a subgraph of , so it does not change the -slice degeneracy.
At a time strictly between two integers and , the instantaneous graph of is the intersection of those at and at , and thus has no larger maximum degree or degeneracy. Therefore all our results apply, with equal to the -slice degeneracy of , equal to the largest maximum degree of a graph , , and at most the number of time steps.
Corollary 1. A temporal graph with vertices, time-edges, time steps and -slice degeneracy has maximal -cliques, and for every fixed this bound is tight up to a factor polynomial in . Its maximal -cliques can be enumerated with setup time and polynomial time delay .
This should be compared with the bounds of [38] and of [9] on the larger number of time-maximal -cliques. In the setup time, the term accounts for the construction of .
We now prove the tightness claimed in Corollary 1. Take the link stream of the proof of Theorem 6, and let and . Every pair other than ab which has a link in this stream gets a time-edge at every integer of , and the pair ab gets the time-edges for . Then the links of ab in are the intervals , which are pairwise disjoint and not consecutive. Up to an increasing relabelling of the times, is thus the link stream of the proof of Theorem 6. It has at least maximal cliques, its -slice degeneracy is , and there are time steps. Therefore the bound of Corollary 1 is tight up to a factor , and the factor cannot be improved.
The same reduction handles a frequency constraint, as in the first step of the algorithm of Pal [56]. Recall that Banerjee and Pal [1] require every pair to interact at least times in every window of length . With the discrete convention of this section, a -clique, for an integer , is defined as a -clique except that, for every integer and all distinct , there are at least time-edges with . Let be the times of the time-edges of a pair . The window contains at least of them if and only if it contains for some , that is, if and only if . We make every maximal set of consecutive integers of the union of these intervals, restricted to , a link of . The pair gets at most links, which are computed in time once the time-edges are sorted, and the proof of Lemma 14 applies verbatim.
Corollary 2. Let be the largest degeneracy of the graphs whose edges are the pairs having at least time-edges in , for integers . A temporal graph with vertices and time-edges has maximal -cliques. These cliques can be enumerated with setup time and polynomial time delay .
The graphs of Corollary 2 are subgraphs of the graphs , so is at most the -slice degeneracy. We conclude with three remarks on the definitions of the literature. First, Banerjee and Pal [1] also allow intervals shorter than , for which the only window is the interval itself. Such a clique is not maximal, since its interval can be extended to an interval of length (recall that ). Thus the two definitions have the same maximal cliques. Second, the reduction also handles weights, as in [13]. Assume that every time-edge has a positive weight, and that is a lower bound on the total weight of the time-edges of a pair in every window. Then the integers such that the window satisfies this bound form at most maximal sets of consecutive integers, since each of them starts at or when a time-edge enters the window. These sets are computed in time by moving the window from one time-edge to the next, and the rest of the reduction is unchanged. Third, Boekhout and Takes [13] require the interval of a clique to start and end with an interaction between two of its vertices. Their maximal cliques thus differ from ours, and our reduction does not apply to them directly. Note that they denote by the number of time steps of a window.
7 Concluding remarks
We presented the first algorithms with polynomial time delay for maximal clique enumeration in link streams, the first one in the maximum degree and the second one in the degeneracy of the instantaneous graphs. We also proved that the maximum number of maximal cliques is up to a factor polynomial in . Several questions remain.
The second algorithm requires that the proper suffixes of the maximal cliques ending at the current time are stored in memory. We ask whether there is an algorithm with time delay polynomial in k and logarithmic in m which only requires space polynomial in the input. A similar question was asked for static graphs in [47], and it is still open.
The time delays of our algorithms contain a factor , which comes from the searches in the data structures built during the setup phase. We ask whether the maximal cliques of a link stream can be enumerated with time delay depending only on k, after a setup phase polynomial in the input. Since these searches are predecessor searches, the answer may depend on the model of computation.
Our online algorithm only has a bound on its total running time. A bound on the time spent for every event would require to maintain an acyclic orientation of small out-degree with a worst-case update time. Kopelowitz et al. [42] obtained worst-case update times, but their orientations need not be acyclic. We ask whether such an orientation can be maintained, and whether it yields an online algorithm whose time per event is polynomial in k and polylogarithmic in n, besides the time spent to output the maximal cliques.
Fix an end time and an anchor . The maximal cliques output for are cliques of the window which are maximal in at the threshold at which their last edge appears, in the increasing sequence of graphs . This raises the following question. How many cliques of an -order graph can be maximal at the moment their last edge appears, when the edges are added one by one? This number is , and a bound would remove the factor from Theorem 6. A heuristic computer search found no insertion sequence with more than about such cliques for .
Finally, it would be interesting to extend our approach to the -k-plexes of [9], to the weighted -cliques of [13] whose intervals must start and end with an interaction (Corollary 2 handles the -cliques of [1], with or without weights), and to the isolated temporal cliques of [53]. For k-plexes of static graphs, a decomposition based on degeneracy orderings has been used in [40]. The maximal cliques of Brunelli et al. [16] are the vertex sets of our maximal cliques which are not strictly contained in a clique of some instantaneous graph. We ask whether they can be listed with polynomial time delay, or even in output polynomial time, in link streams in which a pair may interact several times. The difficulty is to test the inclusion in cliques which exist at other times. The algorithms of this paper are simple to implement with a degeneracy ordering recomputed when needed, and an experimental comparison with the algorithm of Baudin et al. [7], whose implementation is public, would show whether the polynomial guarantee on the time per maximal clique matters on real data.
We implemented Algorithms 1 and 2, the latter both with degeneracy orderings and with arbitrary orders, and compared their outputs with an exhaustive search over all vertex sets and intervals on more than 10 000 random link streams with up to ten vertices, including streams in which many links share their end times. The outputs coincided in all cases. We also checked on these instances that every rejected candidate of Algorithm 2 is examined after the output of the maximal clique to which it is sent by Lemma 12, and that the constructions of Theorems 2 and 6 have the stated numbers of maximal cliques. Finally, we checked the bijection of Lemma 14 against an exhaustive search of the maximal -cliques of random temporal graphs, and the construction that follows Corollary 1 for small values of p, h, R and . We did the same for the -cliques of Corollary 2, with and without weights, and we checked that they have the same maximal cliques as the definition of [1].
Acknowledgements
The author used AI assistants, in particular Claude (Anthropic), to obtain some of the results of this paper, to check them with computer experiments, and to prepare the manuscript.
References
[1] S. Banerjee, B. Pal, On the enumeration of maximal ( , )-cliques of a temporal network, in: Proceedings of the ACM India Joint International Conference on Data Science and Management of Data (CoDS-COMAD), 2019, pp. 112–120.
[2] S. Banerjee, B. Pal, A two-phase approach for enumeration of maximal ( , )-cliques of a temporal network, in: Database and Expert Systems Applications (DEXA 2021), Lecture Notes in Comput. Sci. 12924, 2021, pp. 346–357.
[3] S. Banerjee, B. Pal, An efficient updation approach for enumerating maximal ( , )-cliques of a temporal network, J. Complex Netw. 10 (5) (2022).
[4] S. Banerjee, B. Pal, A two-phase approach for enumeration of maximal ( , )-cliques of a temporal network, Soc. Netw. Anal. Min. 14 (1) (2024) 54.
[5] A. Baudin, Cliques statiques et temporelles : algorithmes d'énumération et de détection de communautés, PhD thesis, Sorbonne Université, 2023.
[6] A. Baudin, C. Magnien, L. Tabourier, LSCPM: communities in massive real-world link streams by clique percolation method, in: 30th International Symposium on Temporal Representation and Reasoning (TIME 2023), LIPIcs 278, 2023, pp. 3:1–3:18.
[7] A. Baudin, C. Magnien, L. Tabourier, Faster maximal clique enumeration in large real-world link streams, J. Graph Algorithms Appl. 28 (1) (2024) 149–178.
[8] M. Bentert, A.-S. Himmel, H. Molter, M. Morik, R. Niedermeier, R. Saitenmacher, Listing all maximal k-plexes in temporal graphs, in: IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining (ASONAM 2018), 2018, pp. 41–46.
[9] M. Bentert, A.-S. Himmel, H. Molter, M. Morik, R. Niedermeier, R. Saitenmacher, Listing all maximal k-plexes in temporal graphs, ACM J. Exp. Algorithms 24 (1) (2019) 1.13.
[10] M. de Berg, O. Cheong, M. van Kreveld, M. Overmars, Computational Geometry: Algorithms and Applications, 3rd edition, Springer, 2008.
[11] D. Berlowitz, S. Cohen, B. Kimelfeld, Efficient enumeration of maximal k-plexes, in: Proceedings of the ACM SIGMOD International Conference on Management of Data, 2015, pp. 431–444.
[12] S. Bhattacharya, M. Henzinger, D. Nanongkai, C.E. Tsourakakis, Space- and time-efficient algorithm for maintaining dense subgraphs on one-pass dynamic streams, in: Proceedings of the 47th Annual ACM Symposium on Theory of Computing (STOC 2015), 2015, pp. 173–182.
[13] H.D. Boekhout, F.W. Takes, Fast maximal clique enumeration in weighted temporal networks, Soc. Netw. Anal. Min. 16 (2026) 10.
[14] G.S. Brodal, R. Fagerberg, Dynamic representations of sparse graphs, in: Algorithms and Data Structures (WADS 1999), Lecture Notes in Comput. Sci. 1663, 1999, pp. 342–351.
[15] C. Bron, J. Kerbosch, Algorithm 457: finding all cliques of an undirected graph, Commun. ACM 16 (9) (1973) 575–577.
[16] F. Brunelli, A. Conte, R. Grossi, A. Marino, Output-sensitive enumeration of maximal cliques in temporal graphs, Discrete Appl. Math. 369 (2025) 66–77.
[17] F. Capelli, Y. Strozecki, Geometric amortization of enumeration algorithms, in: 40th International Symposium on Theoretical Aspects of Computer Science (STACS 2023), LIPIcs 254, 2023, pp. 18:1–18:22.
[18] F. Capelli, Y. Strozecki, From amortized to worst case delay in enumeration algorithms, Comput. Complexity 35 (2) (2026) 6.
[19] A. Casteigts, P. Flocchini, W. Quattrociocchi, N. Santoro, Time-varying graphs and dynamic networks, Int. J. Parallel Emergent Distrib. Syst. 27 (5) (2012) 387–408.
[20] A. Casteigts, J.G. Peters, J. Schoeters, Temporal cliques admit sparse spanners, in: 46th International Colloquium on Automata, Languages, and Programming (ICALP 2019), LIPIcs 132, 2019, pp. 134:1–134:14.
[21] L. Chang, J.X. Yu, L. Qin, Fast maximal cliques enumeration in sparse graphs, Algorithmica 66 (1) (2013) 173–186.
[22] N. Chiba, T. Nishizeki, Arboricity and subgraph listing algorithms, SIAM J. Comput. 14 (1) (1985) 210–223.
[23] S. Cohen, B. Kimelfeld, Y. Sagiv, Generating all maximal induced subgraphs for hereditary and connected-hereditary graph properties, J. Comput. System Sci. 74 (7) (2008) 1147–1159.
[24] A.B.G. Christiansen, E. Rotenberg, Fully-dynamic arboricity decompositions and implicit colouring, in: 49th International Colloquium on Automata, Languages, and Programming (ICALP 2022), LIPIcs 229, 2022, pp. 42:1–42:20.
[25] A. Comin, R. Rizzi, An improved upper bound on maximal clique listing via rectangular fast matrix multiplication, Algorithmica 80 (12) (2018) 3525–3562.
[26] A. Conte, R. Grossi, A. Marino, L. Versari, Sublinear-space and bounded-delay algorithms for maximal clique enumeration in graphs, Algorithmica 82 (6) (2020) 1547–1573.
[27] A. Conte, E. Tomita, On the overall and delay complexity of the CLIQUES and Bron-Kerbosch algorithms, Theoret. Comput. Sci. 899 (2022) 1–24.
[28] Q. Dai, R.-H. Li, M. Liao, G. Wang, Maximal defective clique enumeration, Proc. ACM Manag. Data 1 (1) (2023) 77.
[29] A. Das, M. Svendsen, S. Tirthapura, Incremental maintenance of maximal cliques in a dynamic graph, VLDB J. 28 (3) (2019) 351–375.
[30] T. Davot, J. Enright, J. Madathil, K. Meeks, Temporal triadic closure: finding dense substructures in social networks that evolve over time, in: Proceedings of the 39th AAAI Conference on Artificial Intelligence (AAAI 2025), 2025, pp. 26939–26946.
[31] J.R. Driscoll, N. Sarnak, D.D. Sleator, R.E. Tarjan, Making data structures persistent, J. Comput. System Sci. 38 (1) (1989) 86–124.
[32] D. Eppstein, M. Löffler, D. Strash, Listing all maximal cliques in large sparse real-world graphs in near-optimal time, ACM J. Exp. Algorithms 18 (2013) 3.
[33] D. Eppstein, D. Strash, Listing all maximal cliques in large sparse real-world graphs, in: Experimental Algorithms (SEA 2011), Lecture Notes in Comput. Sci. 6630, 2011, pp. 364–375.
[34] E. Galimberti, A. Barrat, F. Bonchi, C. Cattuto, F. Gullo, Mining (maximal) span-cores from temporal networks, in: Proceedings of the 27th ACM International Conference on Information and Knowledge Management (CIKM 2018), 2018, pp. 107–116.
[35] M. Henzinger, S. Neumann, A. Wiese, Explicit and implicit dynamic coloring of graphs with bounded arboricity, arXiv:2002.10142, 2020.
[36] D. Hermelin, Y. Itzhaki, H. Molter, R. Niedermeier, Temporal interval cliques and independent sets, Theoret. Comput. Sci. 961 (2023) 113885.
[37] A.-S. Himmel, H. Molter, R. Niedermeier, M. Sorge, Enumerating maximal cliques in temporal graphs, in: IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining (ASONAM 2016), 2016, pp. 337–344.
[38] A.-S. Himmel, H. Molter, R. Niedermeier, M. Sorge, Adapting the Bron–Kerbosch algorithm for enumerating maximal cliques in temporal graphs, Soc. Netw. Anal. Min. 7 (1) (2017) 35.
[39] P. Holme, J. Saramäki, Temporal networks, Phys. Rep. 519 (3) (2012) 97–125.
[40] M. Jiddou, G. Manoussakis, Efficient enumeration of k-plexes and k-defective cliques, in: 20th International Symposium on Parameterized and Exact Computation (IPEC 2025), LIPIcs, 2025, pp. 22:1–22:16.
[41] D.S. Johnson, M. Yannakakis, C.H. Papadimitriou, On generating all maximal independent sets, Inform. Process. Lett. 27 (3) (1988) 119–123.
[42] T. Kopelowitz, R. Krauthgamer, E. Porat, S. Solomon, Orienting fully dynamic graphs with worst-case time bounds, in: Automata, Languages, and Programming (ICALP 2014), Lecture Notes in Comput. Sci. 8573, 2014, pp. 532–543.
[43] M. Latapy, T. Viard, C. Magnien, Stream graphs and link streams for the modeling of interactions over time, Soc. Netw. Anal. Min. 8 (1) (2018) 61.
[44] R.-H. Li, J. Su, L. Qin, J.X. Yu, Q. Dai, Persistent community search in temporal networks, in: 34th IEEE International Conference on Data Engineering (ICDE 2018), 2018, pp. 797–808.
[45] Q.C. Liu, J. Shi, S. Yu, L. Dhulipala, J. Shun, Parallel batch-dynamic algorithms for k-core decomposition and related graph problems, in: Proceedings of the 34th ACM Symposium on Parallelism in Algorithms and Architectures (SPAA 2022), 2022, pp. 191–204.
[46] K. Makino, T. Uno, New algorithms for enumerating all maximal cliques, in: Scandinavian Workshop on Algorithm Theory (SWAT 2004), Lecture Notes in Comput. Sci. 3111, 2004, pp. 260–272.
[47] G. Manoussakis, A new decomposition technique for maximal clique enumeration for sparse graphs, Theoret. Comput. Sci. 770 (2019) 25–33.
[48] G. Manoussakis, Maximal clique enumeration with delay depending only on the degeneracy, manuscript, 2026.
[49] D.W. Matula, L.L. Beck, Smallest-last ordering and clustering and graph coloring algorithms, J. ACM 30 (3) (1983) 417–427.
[50] O. Michail, An introduction to temporal graphs: an algorithmic perspective, Internet Math. 12 (4) (2016) 239–280.
[51] H. Molter, Classic graph problems made temporal: a parameterized complexity analysis, PhD thesis, Technische Universität Berlin, 2020.
[52] H. Molter, R. Niedermeier, M. Renken, Enumerating isolated cliques in temporal networks, in: Complex Networks and Their Applications VIII, Stud. Comput. Intell. 882, Springer, 2019, pp. 519–531.
[53] H. Molter, R. Niedermeier, M. Renken, Isolation concepts applied to temporal clique enumeration, Netw. Sci. 9 (S1) (2021) S83–S105.
[54] J.W. Moon, L. Moser, On cliques in graphs, Israel J. Math. 3 (1) (1965) 23–28.
[55] T.J. Ottosen, J. Vomlel, Honour thy neighbour: clique maintenance in dynamic graphs, in: Proceedings of the Fifth European Workshop on Probabilistic Graphical Models (PGM 2010), 2010, pp. 201–208.
[56] B. Pal, A recursive approach for maximal -clique enumeration in temporal networks, in: Advances in Databases and Information Systems (ADBIS 2024), Lecture Notes in Comput. Sci. 14918, 2024, pp. 79–92.
[57] H. Qin, R.-H. Li, G. Wang, L. Qin, Y. Cheng, Y. Yuan, Mining periodic cliques in temporal networks, in: 35th IEEE International Conference on Data Engineering (ICDE 2019), 2019, pp. 1130–1141.
[58] H. Qin, R.-H. Li, Y. Yuan, G. Wang, L. Qin, Z. Zhang, Mining bursting core in large temporal graphs, Proc. VLDB Endow. 15 (13) (2022) 3911–3923.
[59] V. Stix, Finding all maximal cliques in dynamic graphs, Comput. Optim. Appl. 27 (2) (2004) 173–186.
[60] E. Tomita, A. Tanaka, H. Takahashi, The worst-case time complexity for generating all maximal cliques and computational experiments, Theoret. Comput. Sci. 363 (1) (2006) 28–42.
[61] S. Tsukiyama, M. Ide, H. Ariyoshi, I. Shirakawa, A new algorithm for generating all the maximal independent sets, SIAM J. Comput. 6 (3) (1977) 505–517.
[62] T. Uno, Constant time enumeration by amortization, in: Algorithms and Data Structures (WADS 2015), Lecture Notes in Comput. Sci. 9214, 2015, pp. 593–605.
[63] T. Viard, M. Latapy, C. Magnien, Revealing contact patterns among high-school students using maximal cliques in link streams, in: IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining (ASONAM 2015), 2015, pp. 1517–1522.
[64] T. Viard, M. Latapy, C. Magnien, Computing maximal cliques in link streams, Theoret. Comput. Sci. 609 (2016) 245–252.
[65] T. Viard, C. Magnien, M. Latapy, Enumerating maximal cliques in link streams with durations, Inform. Process. Lett. 133 (2018) 44–48.
[66] H. Wu, J. Cheng, Y. Lu, Y. Ke, Y. Huang, D. Yan, H. Wu, Core decomposition in large temporal graphs, in: IEEE International Conference on Big Data, 2015, pp. 649–658.
[67] L. Zhao, Z. Chen, L. Ye, Y. Guan, W. Liu, Maximal -biclique enumeration in temporal bipartite graphs, Knowl. Inf. Syst. 67 (11) (2025) 10833–10861.
[68] K. Zhu, G. Fletcher, N. Yakovets, O. Papapetrou, Y. Wu, Scalable temporal clique enumeration, in: Proceedings of the 16th International Symposium on Spatial and Temporal Databases (SSTD 2019), 2019, pp. 120–129.
| Algorithm | Model | Setup | Enumeration |
| Viard et al. [64] | -cliques | ||
| Himmel et al. [38] | -cliques | and | |
| Viard et al. [65] | durations | ||
| Bentert et al. [9] | -k-plexes | for cliquesFPT with respect to , output sensitive in | |
| Molter et al. [52, 53] | isolated -cliques | FPT with respect to the isolation parameter; not output sensitive | |
| Banerjee and Pal [1] | -cliques | ||
| Banerjee and Pal [2, 3, 4] | -cliques | bounds in terms of the input; experiments | |
| Pal [56] | -cliques | ||
| Boekhout and Takes [13] | weighted -cliques, interactions at both ends | first phase in ; experiments | |
| Baudin et al. [7] | durations | and , | |
| Brunelli et al. [16] | one interval per pair; vertex sets | , where is their number of solutions; first solutions in | |
| This paper, Thm. 3 | durations | ||
| This paper, Thm. 8 | durations | ||
| This paper (online), Thm. 7 | durations |
: polynomial time delay algorithms, with time delay and respectively. The online algorithm has no setup phase, and its total running time is given.
Table 1: Bounds for maximal clique enumeration in link streams and temporal graphs. The results are presented chronologically.
| Reference | Objects counted | Upper bound | Lower bound |
| Himmel et al. [38] | time-maximal -cliques | ||
| Bentert et al. [9] | time-maximal -cliques | ||
| Davot et al. [30] | maximal -cliques, closure , instability | ||
| This paper, Thm. 2 | maximal cliques | ||
| This paper, Ex. 1 | maximal cliques | with | |
| This paper, Thm. 6 | maximal cliques |
for -cliques. For [30], is the length of the windows of the -cliques, and and are the closure and instability parameters. Every maximal clique is time-maximal, so the first two rows also bound the number of maximal -cliques.
Table 2: Bounds on the number of maximal cliques of link streams and temporal graphs.