Efficient enumeration of non-isomorphic interval graphs

Recently, Yamazaki et al. provided an algorithm that enumerates all non-isomorphic interval graphs on $n$ vertices with an $O(n^4)$ time delay. In this paper, we improve their algorithm and achieve $O(n^3 \log n)$ time delay. We also extend the catalog of these graphs providing a list of all non-isomorphic interval graphs for all $n$ up to $15$.


Introduction
Graph enumeration problems, besides their theoretical value, are of interest not only for computer scientists, but also to other fields, such as physics, chemistry, or biology. Enumeration is helpful when we want to verify some hypothesis on a quite big set of different instances, or find a small counterexample. For graphs it is natural to say that two graphs are "different" if they are non-isomorphic. Many papers dealing with the problem of enumeration were published for certain graph classes, see Kiyomi et al. (2006); Saitoh et al. (2010Saitoh et al. ( , 2012; Yamazaki et al. (2018). A series of potential applications in molecular biology, DNA sequencing, network multiplexing, resource allocation, job scheduling, and many other problems, makes the class of interval graphs, i.e. intersection graphs of intervals on the real line, a particularly interesting class of graphs. In this paper, we focus on interval graphs, and our goal is to find an efficient algorithm that for a given n lists all non-isomorphic interval graphs on n vertices. It is well-known that the number of such graphs is roughly n nc for some constant c, see Acan (2018); Hanlon (1982); J.C. Yang (2017). For that reason, we measure the efficiency of the enumeration algorithm by the worst-case time delay between output of any two successive graphs.

Our results
In this paper we revisit the work of Yamazaki et al. and show how to modify their enumeration algorithm to significantly reduce the worst-case time delay between the output of two successive graphs. Our key observation is the fact that having an MPQ-tree corresponding to a graph G = (V, E) we are able to list all edges e such that a graph G e = (V, E {e}) is an interval graph. Moreover, for each such edge we show how to build an MPQ-tree corresponding to the graph G e without constructing it explicitly.

Organization of this paper
In the next section we introduce concepts and definitions that are widely used in this paper, and also provide a detailed description of MPQ-trees along with their most important properties. In Section 3, we present a total ordering over all MPQ-trees, define a canonical MPQ-tree using this ordering, and also present a fast algorithm that for a given MPQ-tree T computes its canonical form T ′ . In Section 4 we consider an MPQ-tree T corresponding to an interval graph G = (V, E), and characterize edges e such that the graph G e = (V, E {e}) is also an interval graph. Moreover, for every edge e we either show a linear time algorithm that produces a string representing G e if it is an interval graph, or show an induced chordless cycle on four vertices or an asteroidal triple in G e that certifies that G e is not an interval graph. In Section 5 we develop data structures and algorithms that make use of combinatorial characterization from Section 4 and present a fast algorithm which for a given MPQ-tree lists all edges e such that G e is an interval graph. Finally, in Section 6 we show how to combine all parts together and build the graph enumeration algorithm. We also show the worst-case performance analysis of our algorithm in this section. The last section contains a discussion of some implementation heuristics that do not change the worst-case analysis, but significantly speedup the execution.

Preliminaries
In this paper we consider only simple graphs without loops and multiple edges. We use the standard notations for graphs, so n = |V (G)| and m = |E(G)|. For a graph G = (V, E) and a pair of vertices i, j ∈ V , we denote G + (i, j) a graph G ′ = (V, E ∪ {(i, j)}), and G − (i, j) a graph G ′ = (V, E {(i, j)}). A graph G = (V, E) with a vertex set V = {1, . . . , n} is an interval graph if there is a set of intervals I = {I 1 , . . . , I n } on the real line such that (i, j) ∈ E iff I i ∩ I j = ∅. The set I is called an interval representation of the graph G. For an interval graph G, we say that an edge (i, j) ∈ E(G) is an interval edge if G − (i, j) is also an interval graph. A sequence S of length 2n is called a string representation if each element x ∈ {1, . . . , n} appears exactly two times in S. Note that a string representation S encodes an interval graph in a natural way. For every x ∈ {1, . . . , n} let f irst(x) denote the index of the first appearance of x in S, second(x) denote the second one, and x is represented by an interval I x = [f irst(x), second(x)].

PQ-trees
It is easy to notice that an interval graph can have many different interval representations. Lueker and Booth (1979) introduced a data structure, called a PQ-tree, which encodes all normalized interval representations of an interval graph. A PQ-tree is a rooted labeled plane tree composed of leaves and two kinds of internal nodes called P-nodes, and Q-nodes respectively. The left to right ordering of the leaves of a PQ-tree T is called the frontier of T . We say that T encodes an interval graph G, if each maximal clique of the graph G is stored in exactly one leaf of T , and each vertex v ∈ V (G) belongs to a consecutive sequence of cliques in the frontier of T . Having a PQ-tree T one can obtain another PQ-tree T ′ which is equivalent to T using the following two operations: arbitrarily permute the children of a P-node, or reverse the order of the children of a Q-node. The crucial property of a PQ-tree T is the fact that for every permutation σ of maximal cliques of the graph G such that each vertex belongs to a consecutive sequence of cliques, there is a PQ-tree T ′ that is equivalent to T , and frontier of T ′ represents σ. In other words, each normalized interval representation of the graph G is represented by some tree equivalent to T .

MPQ-trees
PQ-trees are quite a simple and easy to understand data structure representing interval graphs, but unfortunately they may occupy up to O n 2 space. To reduce the space consumption, Korte and Möhring (1989) presented modified PQ-trees called MPQ-trees. In an MPQ-tree, we do not store maximal cliques in leaves, but we assign to each P-node and each child of a Q-node a set of vertices in such a way that vertices laying on a path from the root of the tree to some leaf represent a maximal clique in G, see Figure  1C for an example. For a Q-node Q with children T 1 , . . . , T k , we denote S i the set of vertices assigned to T i , and call it the i-th section of Q. Note that, each vertex belongs to the consecutive sequence of maximal cliques, so it has to belong to consecutive sequence of sections of a Q-node. Hence, in order to limit the used space, we can store the information about the vertex x only in the first and last section it belongs to. Thanks to this modification, an MPQ-tree is an O(n) space representation of an interval graph. In this paper we show several drawings of MPQ-trees. We represent P-nodes as circles, and Q-nodes as rectangles divided into smaller rectangles representing sections of the Q-node. For instance, in the Figure  1C the root is an empty P-node, and the vertex 6 belongs to the sections S 2 and S 3 of the only Q-node.  1,5,3,2,4,4,2,6,3,8,7,7,6,5,13,11,9,9,12,12,11,10,10,13,8 E) 1,1,2,3,4,5,5,4,6,3,7,8,8,6,2,9,10,10,11,12,12,13,13,11,9,7 Fig. 1: A) An interval graph G, B) Its interval representation I, C) Its MPQ-tree T , D) String representation S of tree T , E) Canonical string representation

Known results
During past decades, many researchers published their results on constructing both PQ-trees and MPQtrees. Those trees were mostly used to determine whether a given graph G = (V, E) is an interval graph or not. Lueker and Booth (1979) in their recognition algorithm used PQ-trees and proved that for a given graph G the corresponding PQ-tree can be computed in O(n + m) time. Korte and Möhring (1989) presented analogous result for MPQ-trees. In this paper we are most interested in work of T. Saitoh (2007) who presented an algorithm that constructs an MPQ-tree for a given interval graph representation and works in O(n log n) time, or O(n) if the endpoints of intervals are given in an ascending order.
Theorem 1 (T. Saitoh (2007) Thm.12) If the graph G is given as an interval representation such that the endpoints are sorted by the coordinates, then there is an algorithm that produces an MPQ-tree corresponding to G in O(n) time.
Clearly, having a string representation of the graph G, we can produce an interval representation satisfying the conditions of Theorem 1 in O(n) time. Hence, we have the following corollary.
Corollary 2 There is an algorithm that for a given string representation S of the graph G builds a corresponding MPQ-tree T in O(n) time.
Before we proceed to technical definitions and lemmas, we provide some naming conventions we are going to use in the rest of this paper. To avoid a confusion when talking about elements of a graph and elements of a tree, we always refer elements of a graph as vertices and elements of a tree as nodes. For a vertex v of a graph G, we denote node(v) the node of a corresponding MPQ-tree T such that v belongs to the set assigned to that node. For a node with k subtrees T 1 , . . . , T k , we denote V i the set of all vertices that are assigned to the nodes of a subtree T i . If V i = ∅, then we say that a subtree T i is empty. For a Q-node we say that a vertex v has its left endpoint in a section S l(v) , if v belongs to S l(v) and does not belong to any other section S b with b < l(v). Analogously, we say that v has its right endpoint in S r(v) , if v belongs to S r(v) and does not belong to any other section For an MPQ-tree T we define a 2n-element string S called string representation of T . This string is built recursively over the structure of T . For a P-node we first output all vertices that belong to that node, then recursively string representations of the children from left to right, and at the end yet again all vertices that belong to that node, but now in the reversed order. Hence, the string representation for a P-node with vertices {1, . . . , k} and no children is 123 . . . (k − 1)kk(k − 1) . . . 321. A string representation for a Qnode is a concatenation of string representations for its sections. The string for a section S i starts with vertices that have its left endpoint in S i , then there is a string for a subtree T i , and finally vertices that have its right endpoint in S i . It is easy to see that string representation of T is also a string representation of the graph corresponding to T . We also define a normalized string representation of T . Consider a permutation σ : {1, . . . , n} → {1, . . . , n}, and a string σ(S), which results from the application of σ to each element of S. Normalized string representation is the lexicographically smallest string σ(S) among all permutations σ. Finally, we recall some properties of MPQ-trees produced by the Algorithm from Theorem 1.
Lemma 3 (Korte and Möhring (1989); Uehara (2005)) In the MPQ-tree constructed in Theorem 1 for every Q-node with k children we have:

Moreover:
g) there are no two empty P-nodes such that one of them is a parent of the other, h) there is no P-node that have only one child which root is also a P-node, and i) P-nodes have no empty children see Figure 2. Fig. 2: MPQ-trees do not contain two consecutive empty P-nodes (left), or a P-node with only one child which root is also a P-node (right).
It is worth noting that MPQ-trees describe interval graph in a natural recursive way. If G consists of at least 2 connected components, then the root node of MPQ-tree T corresponding with G is an empty P-node, and each subtree corresponds to each connected component of G. If G is connected an vertices v i1 , . . . , v i k are universal in G (vertex is universal if it is connected to all other vertices), then the root of T node is a P-node containing v i1 , . . . , v i k . In the remaining cases the root of T is a Q-node.

Canonical MPQ-tree
In this section, we define a total ordering ≺ on MPQ-trees. One may notice that the lexicographical order on string representations is a total ordering on MPQ-trees, but for complexity reasons we introduce a different one. Denote |T | the number of vertices contained in the tree T , c(T ) the number of children of the root of T , and ex(T ) the number of vertices that belong to the root of T . We assign a tuple t T = |T |, ex(T ), c(T ) ∈ N 3 to every tree T , and say that if t T1 is lexicographically smaller than t T2 , then T 1 ≺ T 2 . For two trees T 1 and T 2 such that t T1 = t T2 , we say that T 1 ≺ T 2 , if the normalized string representation of T 1 is lexicographically not greater than normalized string representation of T 2 . We say that MPQ-tree T is in canonical form, if for every other tree T ′ representing the same graph G we have T ≺ T ′ . A string S is a canonical string, if it is a normalized string representation of a canonical tree. Observe that if T is in a canonical form, then all subtrees of T are in a canonical form. Clearly, if some subtree of T is not in a canonical form, then we may rotate it and obtain a lexicographically smaller string.
Theorem 4 Two interval graphs G 1 and G 2 are isomorphic if and only if their canonical strings S 1 and S 2 are equal.
Theorem 5 There is an algorithm that for every MPQ-tree T computes its canonical form in O(n log n) time.
Proof: At the very beginning, we shall compute a function g that for every vertex v will describe its relative position among all vertices from node(v). We compute this function for each P-node independently, and for all Q-nodes collectively. For a P-node with j vertices z 1 , . . . , z j , we assign g(z i ) = i. Thus, we can compute the function g for all P-nodes in O(n) time. In order to compute this function for all Q-nodes, at first we assign a tuple l(v), r(v) to each vertex v which belongs to some Q-node. Then we sort all tuples using radix sort algorithm, and visit vertices in the order determined by their tuples. For each Q-node we keep a local counter that starts with 1 and increases each time we visit a vertex from this node. Thus, because all vertices are from the set {1, . . . , n}, and each Q-node has a linear in terms of n number of sections, we compute this function for all vertices in O(n) time.
We shall construct a function f that assigns an integer f (T ′ ) > n to every subtree T ′ of a tree T in such a way that T 1 ≺ T 2 ⇔ f (T 1 ) f (T 2 ). Simultaneously we will rotate subtrees so that they are in canonical form. At first, we compute tuples t T ′ for each subtree T ′ of a tree T . Clearly, it can be easily done in O(n) time. Then, we sort the tuples lexicographically in O(n) using radix sort algorithm. In the next phases, we inspect nodes of tree T that have the same tuple |T ′ |, ex(T ′ ), c(T ′ ) , and we do it from the smallest tuples to the biggest ones. Observe that, when we define the value of the function f for T ′ , the values for all subtrees of T ′ are already computed.
All subtrees of T ′ are in a canonical form, so in order to compute a canonical form of T ′ , we need to determine the order of its children. If the root of T ′ is a P-node, then we use integers f (T i ) as keys for children, and sort them in O(c log c) time, where c = c(T ′ ). If the root of T ′ is a Q-node Q, then we may leave it in the form it is or reverse it. To decide what to do, we compute a special string representation S * , which is similar to the string representation, but for each vertex v that belongs to Q we put g(v) instead of v, and instead of inserting the whole string for a subtree T i , we put a single number f (T i ). Hence, the produced string has length 2 * ex(T ′ ) + c(T ′ ) and is produced in time proportional to its length. We also produce similar string for a rotated node, and if that string is lexicographically smaller than the original one, then we rotate Q. Otherwise, we do nothing.
We have just computed canonical forms for all subtrees with the same tuple. For each of them we produce a special string, and sort those strings lexicographically. Finally, we assign values from the set {F + 1, F + 2, . . .}, where F is the maximal number assigned to trees with lexicographically smaller tuples (or F = n if there are no smaller). We assign those numbers according to the computed order giving the same value to the subtrees with the same special string representation, and that finishes the algorithm description. Now, we prove the algorithm works in the declared time. As we mentioned before, the computation of the function g is linear in time. The same applies to the computation and sorting for the node tuples. Sorting children of a P-node with c children takes O(c log c). Hence, because all P-nodes cannot have more than O(n) children in total, we conclude that sorting children for all P-nodes takes no more than O(n log n) time. The length of a special string for a Q-node with j vertices and k sections is O(j + k). Thus, the total processing time for all Q-nodes is linear in terms of n.
The only thing we have not counted yet is the time spent on sorting subtrees with the same tuple. Note that for a tuple s, e, c , each special string has length exactly 2e + c. Let n sec be the number of subtrees having a tuple s, e, c . Sorting process for those subtrees takes no more than O((e + c)n sec log n sec ). Thus, all sortings together take O( sec (e + c)n sec log n sec ). Note that n sec n, so we only need to show that sec (e + c)n sec is O(n). But, clearly sec en sec = n since this sum counts vertices in all nodes. Similarly, sec cn sec equals the number of edges in T , and we are done. ✷

Interval edges
In this section we present a series of lemmas that characterize the interval edges for the interval graph G. Moreover, for each interval edge (x, y), we also present a linear in terms of n algorithm that produces a string representation for the interval graph G − (x, y). For an edge (x, y) that is not an interval edge, we prove the existence of an induced chordless cycle on four vertices or an asteroidal triple in G − (x, y). The characterization does not use the mere graph G, but the corresponding MPQ-tree T instead.
First, let us introduce an useful definition. We say that x is over y in T , if (x, y) ∈ E(G) and node(x) is the lowest common ancestor of node(x) and node(y) in T . Notice that, if there is an edge (x, y) in the graph G, then x is over y, or y is over x. Now, we make an easy observation on interval edges.
Observation 6 If there are at least two vertices z 1 and z 2 such that both x and y are over z 1 and z 2 , and there is no edge (z 1 , z 2 ), then (x, y) is not an interval edge.
Proof: Vertices x, z 1 , y and z 2 in that order form a cycle of length 4. We assumed that there is no edge between z 1 and z 2 , so if there is no edge between x and y, then this cycle is chordless in G − (x, y), see Figure 3. Hence, G − (x, y) is not a chordal graph and so not an interval graph. The above observation is useful when we want to prove that the edge (x, y) is not an interval edge. However, in cases when (x, y) is an interval edge, we want to show a linear time algorithm that produces a string representation for a graph G − (x, y). The following lemma, we call the swapping lemma, comes handy when we try to produce the mentioned string. It shows when we can swap two consecutive elements in a string representation without adding or removing any edges to the represented graph.
Lemma 7 Let S 1 and S 2 be string representations, such that S 2 is created from S 1 by swapping elements at positions i and i + 1 for some i. Denote a the element at the i-th position in S 1 , and b the element at the (i + 1)-th position (S 1 = ....ab.. and S 2 = ....ba..). S 1 and S 2 represent the same interval graph iff both elements at swapped positions represent either left endpoints or right endpoints.
Proof: Clearly, at most one edge can be added or removed by swapping those two elements. If we swap the left endpoint of a and the right endpoint of b, then we remove an edge (a, b). If we swap the right endpoint of a and the left endpoint of b, then we add an edge (a, b) which is not present in S 1 . If both elements represent left endpoints, then right endpoints for both a and b are to the right of i + 1, hence no edge is added or removed. Similar argument works when both elements represent right endpoints. ✷ Our aim is to characterize all interval edges encoded by an MPQ-tree T . Hence, as an input we are given an MPQ-tree T and some edge (x, y) ∈ E(G). Without loss of generality, we assume that x is over y in T , and we work under this assumption in the following subsections. We split our argument into cases according to the relative position of node(x) and node(y) in T .

x and y belong to the same P-node
At first, we consider the case where both x and y belong to the same P-node P in T . We show that under this assumption, the edge (x, y) is an interval edge if and only if P is a leaf in T .
Lemma 8 If node(x) = node(y) is a P-node that is not a leaf, then (x, y) is not an interval edge.
Proof: Let P be the considered common P-node, and assume it has j subtrees for some j 1. If j 2, then by Lemma 3i let z 1 ∈ V 1 and z 2 ∈ V 2 . Clearly, there is no edge between z 1 and z 2 and both x and y are over z 1 and z 2 . Hence, Observation 6 implies that (x, y) is not an interval edge. Thus, P has exactly one subtree, and according to Lemma 3h, its root has to be a Q-node, see Figure 4. Moreover, Lemma 3a implies, that the first and last sections of a Q-node have nonempty subtrees. Let z 1 belong to the first subtree, and z 2 belong to the last one. Yet again, conditions of the Observation 6 are satisfied, so (x, y) is not an interval edge. ✷ Lemma 9 If node(x) = node(y) is a P-node that is a leaf, then (x, y) is an interval edge. Moreover, there is a linear time algorithm that produces a string representation for the graph G − (x, y).

T1
T k x, y T1 T2 Fig. 4: Removing an edge from a P-node that is not a leaf leads to an induced C4 cycle.
Proof: Without loss of generality assume that x < y, and consider the canonical string S for the MPQ-tree T . Clearly, S is of the form S = LAxByCCyBxĀR, see Figure 5. In order to remove the edge (x, y) we find the first and the last occurrence of x in S. Then, until x does not occupy two consecutive positions, we , where i denotes the first occurrence of x and j denotes the second. Next, we do the same for y, and as a result we get a string such that both y's are next to each other and are surrounded by both x's, see Figure 5c. Finally, we swap the first occurrence of y with the second occurrence of x, effectively removing the edge (x, y). Clearly, this procedure runs in O(n) time, but we have to ensure that it does not add or remove any other edge. Note that, all modifications are performed in a substring of S that represents a clique, and is of the form z 1 z 2 . . . z k z k . . . z 2 z 1 . Hence, each swapping operation -except the last one -swapped either two left endpoints or two right endpoints. Thus, Lemma 7 ensures that no edge was added or removed during this process. Finally, during the last swap x and y occupy four consecutive indexes. Hence, the only affected vertices are x and y.

x and y belong to the same Q-node
The next case is when both vertices belong to the same Q-node. Here we show that (x, y) is an interval edge if and only if x and y have exactly one common section and the subtree of this section represents a clique (possibly empty).
is not an interval edge if: 1.
x and y have more than one common section in node(x) = node(y), or 2. a subtree of the common section does not represent a clique (possibly empty).
Proof: Assume that there is a common section S i and its nonempty subtree T i that does not represent a clique. Hence, there are at least two vertices z 1 and z 2 in V i such that there is no edge between them, otherwise T i would represent a clique. Thus, Observation 6 implies that (x, y) is not an interval edge. Moreover, if there are two common sections S i and S j such that both of them have nonempty subtrees T i and T j respectively, then we may choose z 1 ∈ V i and z 2 ∈ V j and use the same argument. This proves that common sections have empty subtrees except at most one which represents a clique. Now, assume that there is more than one common section ie. S i , S i+1 , . . . , S j−1 , S j , and without loss of generality S i has an empty subtree. Lemma 3f implies that there is a vertex z 1 for which the section S i is the last one (z 1 does not belong to sections S i+1 , . . . , S j ). Notice that z 1 / ∈ {x, y}, otherwise j = i. If there is a nonempty subtree T a for some i < a j, then we choose z 2 ∈ V a , and Observation 6 leads to an induced chordless cycle. Hence, all common subtrees are empty and Lemma 3f gives us a vertex z 2 for which S j is the first section. Observation 6 for vertices x, y, z 1 and z 2 finishes the proof. ✷

Lemma 11
If node(x) = node(y) is a Q-node, x and y have exactly one common section S i in it, and the subtree T i represents a clique, then (x, y) is an interval edge. Moreover, there is a linear time algorithm that produces a string representation for the graph G − (x, y).
Proof: Again, we assume that x < y and consider the canonical string S for the MPQ-tree T , but in this case S has a more complex form than in the Lemma 9. In fact, it is of the form P 1 xP 2 L 1 yL 2 V iVi R 1 xR 2 S 1 yS 2 , where L 1 ∪ L 2 represents the left endpoints of vertices from S i , R 1 ∪ R 2 represents the right endpoints of vertices from S i , and V i ∪V i represents a clique from the subtree, see Figure 6. In order to remove the edge (x, y), at first we need to determine for each element in S whether it represents the left or the right endpoint. It can be easily done in O(n), since all elements in S belong to the set {1, . . . , n}. The next phase swaps the first occurrence of y with its successor until the next element represents a right endpoint. Analogously, we swap the second occurrence of x with its predecessor until the next element represents a left endpoint. Clearly, because of Lemma 7 we did not add or remove any edge till this moment, and S looks like in Figure 6c. Finally, we can remove the edge (x, y) by swapping the first occurrence of y with the second occurrence of x, that in fact occupy consecutive positions in S.  In the previous two subsections, we provided a full classification for the cases where x and y belong to the same node in T . In this subsection, we consider the cases where x and y belong to different nodes in T . Before we present our results in those cases, we introduce a terminology that allows us to describe a relative position of node(x) and node(y) in T .
For a Q-node with k sections S 1 , . . . , S k , we say that the section S a is a central section if 1 < a < k. Sections S 1 and S k are called non-central sections. For a vertex v we say that the section S a is a v-central section if l(v) < a < r(v). Sections S l(v) and S r(v) are v-non-central sections. For every two vertices x and y, there is exactly one path in the tree T between node(x) and node(y). We say that this unique path is an x, y -tree-path if x is over y in T . For an x, y -tree-path: node(x) = n 1 −n 2 −. . .−n t = node(y), we say that this path goes through the central section if there is a Q-node n i for 1 < i < t such that n i+1 belongs to a subtree of some central section of n i , see Figure 10. Moreover, we say that the path starts in a central section if n 1 is a Q-node, and n 2 belongs to a subtree of some x-central section. Analogously, it starts in a non-central section if n 2 belongs to a subtree of some x-non-central section. We also say that an x, y -tree-path starts in a P-node, if node(x) is a P-node, and ends in a P-node if node(y) is a P-node. Analogous definitions apply to Q-nodes. Finally, we say that an x, y -tree-path is almost rotable if it does not go through the central section, and ends in a P-node that is a leaf. An x, y -tree-path is rotable if it is almost rotable, and either starts in a P-node, or starts in a non-central section. Intuitively, if an x, y -tree-path is almost rotable, then we are able to rotate all the nodes on the path n 2 − . . . − n t in such a way that y is the leftmost vertex in the subtree which root is n 2 . Now we are ready to characterize interval edges in the case where x and y belong to different nodes in T . We prove that if x, y -tree-path is rotable, then (x, y) is an interval edge. Unfortunately, the reverse implication is not true and sometimes x, y -tree-path is not rotable, but (x, y) is still an interval edge. We shall prove that this happens only for almost rotable x, y -tree-paths satisfying some additional, and quite technical, conditions. First, we show how to compute a string representation for an interval graph G − (x, y) if x, y -tree-path is rotable.

Lemma 12
If an x, y -tree-path is rotable, then (x, y) is an interval edge. Moreover, there is a linear time algorithm that produces a string representation for the graph G − (x, y).
Proof: In order to remove the edge (x, y), we do not produce a canonical string S immediately. At first, we need to adjust the tree T using some preprocessing. If node(x) is a Q-node, then we rotate node(x) so that x, y -tree-path starts in the section S l(x) . Then, we rotate T so that the path from node(x) to node(y) goes through the leftmost children of P-nodes and the leftmost sections of Q-nodes. Let T ′ be the result of the described adjustment, and let S be a string representation of T ′ . Clearly, S is of form LxAByCCyBDxR, see Figure 7, and both occurrences of y lay in between occurrences of x in S. Node node(y) is a P-node that is a leaf, so we start with moving the first occurrence of y to the right and the second occurrence of y to the left until they both meet, as in the Lemma 9. All vertices that lay between the first occurrence of x and the first occurrence of y represent the left endpoints. Hence, we can swap the first occurrence of x with its successor until it meets the second occurrence of y. Lemma 7 ensures that no edge is added or removed during this process. Finally, moving x once more to the right swaps the left endpoint of x with the right endpoint of y effectively removing the edge (x, y). ✷ Now, we consider those x, y -tree-paths that are not rotable, but are almost rotable. Hence, all those paths start in some x-central section of some Q-node. We denote S 1 , . . . , S k the sections of considered Qnode, and S a the x-central section where the x, y -tree-path starts. As we already mentioned, sometimes in that case the edge (x, y) is an interval edge. The next two lemmas establish the required conditions for that to happen.

Lemma 13
If an x, y -tree-path is almost rotable, starts in a central section S a , y has no neighbor in a subtree T a and: then (x, y) is an interval edge. Moreover, there is a linear time algorithm that produces a string representation for the graph G − (x, y).
Proof: Proofs for all four cases are very similar, so we show only the proof for the first case. Assume that there is a 1 < b l(x) such that S a {x} ⊂ S b and S b−1 ∩ S b ⊂ S a . As in the proof of Lemma 12, before we produce the string representation S, we need to make some adjustments in the tree T . At first, we insert a new section S * = S a {x} in between sections S b−1 and S b , see Figure 8. Clearly, an insertion of a new section does not remove the old edges, but it might add some new ones. However, the section S * is a subset of an already existing section, so it is not the case. Moreover, the condition that each vertex belongs to the sequence of consecutive sections is preserved. That's because we assumed that S b−1 ∩ S b ⊂ S a and S a {x} ⊂ S b . Next, we remove the vertex y from the subtree T a . We also define a subtree T * of the section S * to be a single P-node containing y. Note that y has no neighbor in T a , so no edges were removed, except the edge (x, y). Thus, we obtained a tree T ′ that encodes the graph G − (x, y). In order to get the string representation for the graph G − (x, y) it is enough to compute the string representation for T ′ . We proved only the first case, but observe that the second case is symmetric, and cases 3 and 4 are the corner cases, so in the third case we simply insert the section S * before S 1 and in the fourth case we insert S * after S k . ✷

Lemma 14
If an x, y -tree-path is almost rotable, starts in a central section S a , y has a neighbor in a subtree T a and: Proof: The proof of this lemma is similar to the proof of Lemma 13, but now y has at least one neighbor in T a , so we cannot simply remove y from T a . That's also the reason why conditions of this lemma are more strict than in the previous one. Yet again, we are going to prove only the first case, so assume that S a {x} ⊂ S l(x) and S l(x)−1 ∩ S l(x) ⊂ S a . Instead of inserting a new section, we remove the section S a and insert it in between sections S l(x)−1 and S l(x) , see Figure 9. Clearly, no edge is added or removed, and the condition that each vertex belongs to the sequence of consecutive sections is preserved. Now, we remove x from the section S a . This, removes the edge (x, y), but also all the edges (x, v), where v ∈ V a . In the next phase, we are going to restore those edges. In order to do it, at first we rotate the subtree T a in such a way that the path from node(x) to node(y) goes through the leftmost children of P-nodes and the leftmost sections of Q-nodes. Then, we compute the string representation S of the modified tree, and move the first occurrence of y to the right and the second occurrence of y to the left until both meet, as in the Lemma 9. After this operation is done, y is the leftmost vertex of the tree T a -its right endpoint appears first in the string representation of T a . In order to restore all the removed edges except (x, y), we move the first occurrence of x in S to the left, until its predecessor is the second occurrence of y. Clearly, this procedure restores all the removed edges except (x, y). ✷ The above two lemmas show the only cases where x, y -tree-path is not rotable, but (x, y) is an interval edge. Now, we are going to show that if x, y -tree-path is not rotable, and the conditions of those lemmas are not satisfied, then (x, y) is not an interval edge. At first, we prove that if x, y -tree-path does not end in a P-node that is a leaf, then (x, y) is not an interval edge.

Lemma 15
If an x, y -tree-path ends in a Q-node, then (x, y) is not an interval edge.
Proof: If y belongs only to central sections (y / ∈ S 1 ∪ S k ), then Lemma 3f implies that there are vertices z 1 ∈ S l(y) ∪ V l(y) S l(y)+1 and z 2 ∈ S r(y) ∪ V r(y) S r(y)−1 . If y belongs to S 1 (or S k ), then just Fig. 9: Removing an edge (x, y) in the case where x, y -tree-path is almost rotable, starts in some x-central section Sa, and y has some neighbor in a subtree Ta. (Case 1) take z 1 ∈ V 1 (or z 2 ∈ V k ). Clearly, there is no edge between z 1 and z 2 , and both x and y are over z 1 and z 2 . Thus, Observation 6 finishes the proof. ✷

Lemma 16
If an x, y -tree-path ends in a P-node that is not a leaf, then (x, y) is not an interval edge.
Proof: The same argument as in Lemma 8. ✷ Now, we are going to prove that if an x, y -tree-path goes through the central section, then (x, y) is not an interval edge. First, we define a nested path. Consider a Q-node with k sections S 1 , . . . , S k . For a clarity let S 0 = S k+1 = ∅, and say that a set of vertices P i,j = (S i ∪ . . . ∪ S j ) (S i−1 ∪ S j+1 ) is a nested path, if for every i a < j there is at least one vertex v a ∈ P i,j that belongs to S a ∩ S a+1 . We call it a nested path, because vertices v i , v i+1 . . . , v j−1 in that order form (possibly not simple) path in the graph G, and all of them are contained in the sections S i , . . . , S j . In the following lemma, we show that if x, y -tree-path goes through a central section of some Q-node, then we can find an asteroidal triple in the graph G − (x, y). Nested paths help us to find this triple.

Lemma 17 If x, y -tree-path goes through the central section, then (x, y) is not an interval edge.
Proof: Assume that the x, y -tree-path goes through some central section S i of a Q-node Q, and let S 1 , . . . , S k be the sections of Q. Subtrees of the first and last section are nonempty, so let z 1 ∈ V 1 and z 2 ∈ V k . We show that vertices y, z 1 and z 2 form an asteroidal triple in the graph G − (x, y).
There is no edge (x, y), so a path z 1 − x − z 2 avoids the neighborhood of y. To prove that there is a path between z 1 and y that avoids the neighborhood of z 2 , we show that there is a nested path P 1,k−1 , and so the shortest path of form z 1 − P 1,k−1 − y fulfill our requirements. Let P 1,j be a nested path with maximum j < k. Clearly, such a path exists. Otherwise, either S 1 is empty, or all vertices that belong to S 1 belong to all sections. In both cases, properties listed in Lemma 3 are violated. Moreover, if j is less than k − 1, then either S j ∩ S j+1 = ∅, or S j ∩ S j+1 ⊂ S k . Again, this contradicts Lemma 3, and we are done. A path from z 2 to y that avoids the neighborhood of z 1 is constructed in a similar way. ✷ A consequence of the previous three lemmas is the following corollary.

Corollary 18
If an x, y -tree-path is not almost rotable, then (x, y) is not an interval edge.
We are almost done with the classification. In Lemma 12 we proved that if an x, y -tree-path is rotable, then (x, y) is always an interval edge. On the other hand, in Lemmas 15, 16 and 17 we considered x, ytree-paths that are not almost rotable, and showed that for such paths (x, y) is not an interval edge. Hence, the only remaining cases are the x, y -tree-paths that are almost rotable, but not rotable. In Lemmas 13 Fig. 10: An x, y -tree-path which goes through a central section Si of some Q-node. and 14 we investigated such paths, and proved that under some additional conditions (x, y) is an interval edge. Now we show that if an x, y -tree-path is almost rotable, but is not rotable, and conditions of Lemmas 13 and 14 are not satisfied, then (x, y) is not an interval edge. This case is the hardest one, and before we prove it, we need to prove two auxiliary lemmas.
Lemma 19 Let S 1 , . . . , S k be the sections of some Q-node in an MPQ-tree T , and for the simplicity Proof: By contradiction, assume that for some pair of indices (a, b) there is no such vertex, so each vertex u ∈ S a ∪ . . . ∪ S b is either contained in S a , . . . , S b , or belongs to S a ∩ . . . ∩ S b . Without loss of generality assume that b < k. Each vertex belongs to at least two sections. Hence, no vertex has its right endpoint in S a or left endpoint in S b , and Lemma 3 implies that V a , V b and V k are not empty. Let and consider any maximal cliques C a , C b and C k such that v a ∈ C a , v b ∈ C b and v k ∈ C k . Note that, T encodes only those orderings of maximal cliques in which either C a < C b < C k or C k < C b < C a . Now, consider a modified tree T ′ in which we reverse the order of sections S a , . . . , S b . Clearly, because of our assumptions, T ′ represents the same interval graph as T , but T ′ encodes an ordering C b < C a < C k , which is not encoded by T . Thus, T is not a valid MPQ-tree, and we are done. ✷

Lemma 20
If an x, y -tree-path starts in a central section S a , and there is a vertex q ∈ S a S l(x) ∪ S r(x) , then (x, y) is not an interval edge.
Proof: By contradiction, assume that (x, y) is an interval edge, Let P l1,r1 for r 1 < a be a nested path that intersects q and have the smallest l 1 . Analogously, let P l2,r2 for a < l 2 be a nested path that intersects q and have the biggest r 2 . Notice that these paths may not exist. For instance, if q has its right endpoint in S a , then P l2,r2 does not exist. At first, we consider the case where both paths do not exist, and prove that there is an asteroidal triple in the graph G − (x, y). By Lemma 19, without loss of generality, there is a vertex v ∈ S r(q) ∩ S r(q)+1 S l(q) . Both paths do not exist, so v has to belong to S a . Moreover, Lemma 3f gives two vertices v L ∈ S l(q) ∪ V l(q) S l(q)+1 , and v R ∈ S r(q)+1 ∪ V r(q)+1 S r(q) . Thus, the paths: v L −x−v R , v L −q −y, and v R − v − y certify the asteroidal triple {v L , v R , y}, and we are done in this case. Now, assume that both paths exist, and put L = max {l 1 , l(x)} and R = min {r 2 , r(x)}. Lemma 3f implies that there is a vertex v L which has its right endpoint in S L or v L ∈ V L . Analogously, define a Sa S l(x) S r(x) x q P l 2 ,r 2 P l 1 ,r 1 Fig. 11: Paths P l 1 ,r 1 and P l 2 ,r 2 .
vertex v R for the section S R . Clearly, both v L and v R are neighbors of x, but they do not belong to the neighborhood of q. Hence, {v L , v R , y} is an asteroidal triple in the graph G − (x, y). To see this, consider the paths: Thus, if both paths exist, then (x, y) is not an interval edge.
Without loss of generality, assume that P l1,r1 exists, but P l2,r2 does not. Lemma 19 implies that there is a vertex v such that v ∈ (S l1−1 ∩ S l1 ) S r(q) , or v ∈ S r(q) ∩ S r(q)+1 S l1 . Note that, a this point v and x might be the same vertex. We assumed that right path does not exist, so S r(q) ∩ S r(q)+1 ⊂ S a . Moreover, l 1 is the smallest index such that there is a nested path P l1,r1 for r 1 < a that intersects q. Hence, S l1−1 ∩ S l1 ⊂ S a , and so in both cases v belongs to S a . Lemma 3f gives three vertices: S r(q)−1 , and v R+1 ∈ S r(q)+1 ∪ V r(q)+1 S r(q) . Note that, both v R and v R+1 are neighbors of x, and both v L and v R+1 are not neighbors of q.
If l 1 < l(x), then the paths: Thus, we conclude that l(x) l 1 < l(q), which means that the whole path P l1,r1 is contained in x. Moreover, v and x are different vertices, and v L is a neighbor of x. If v ∈ (S l1−1 ∩ S l1 ) S r(q) , then there is an asteroidal triple {v L , v R , y} certified by paths: Thus, in this case the edge (x, y) is also not an interval edge, and we are done. ✷ Finally, we are ready to prove the last two negative results on interval edges.

Lemma 21
If an x, y -tree-path starts in a central section S a , y has a neighbor in subtree T a , and: , and 2. j < k ⇒ ∃ zj =x : z j ∈ S a S j or ∃z j :z j ∈ (S j ∩ S j+1 ) S a , and 3. i = 1 ⇒ ∃ z1 =x : z 1 ∈ S a S 1 , and where i = l(x) and j = r(x), then (x, y) is not an interval edge.
Proof: By contradiction, assume that (x, y) is an interval edge, and let z be the neighbor of y in T a . If both vertices z i and z j exist, and z i = z j , then z i ∈ S a (S i ∪ S j ), and Lemma 20 leads to a contradiction. Hence, if both of them exist, then z i = z j . But, in this case we can find an asteroidal triple {v L , v R , y}, Thus, without loss of generality z j does not exist, and there is a vertexz j which belongs to (S j ∩ S j+1 ) S a . Ifz i also exists, then consider vertices v L ∈ (S i−1 ∪ V i−1 ) S i , and v R ∈ (S j+1 ∪ V j+1 ) S j that are given by Lemma 3f, and notice that paths: Hence,z i does not exist, and the only remaining case is wherez j and z i exist. Note that if z i does not belong to S j , then z i ∈ S a (S i ∪ S j ) and Lemma 20 gives a contradiction. Hence, z i ∈ S j and there is an edge between z i andz j . Lemma 3f gives vertices v L ∈ (S i ∪ V i ) S i+1 and v R ∈ (S j+1 ∪ V j+1 ) S j , and the asteroidal triple {v L , v R , y} is certified by paths:

Lemma 22
If an x, y -tree-path starts in a central section S a , y does not have a neighbor in subtree T a , and: then (x, y) is not an interval edge.
Proof: By contradiction, assume that (x, y) is an interval edge. Let p L be the longest sequencez l(x) ,z l(x)−1 , . . . ,z L , and p R be the longest sequencez r(x) ,z r(x)+1 , . . . ,z R . If both sequences are empty, then there are vertices z l(x) ∈ S a S l(x) and z r(x) ∈ S a S r(x) . But, the same argument as in Lemma 21, shows that there is an asteroidal triple in the graph G − (x, y). Thus, without loss of generality p L is not empty. If both sequences are not empty, then Lemma 3f gives vertices v L ∈ (S L−1 ∪ V L−1 ) S L and v R ∈ (S R+1 ∪ V R+1 ) S R . Moreover, both sequences are the longest possible, so there are vertices z L−1 ∈ S a S L−1 and z R+1 ∈ S a S R+1 . Thus, the paths and v R − p R − x − z L−1 − y certify the asteroidal triple {v L , v R , y}. Hence, p R is empty, but p L is not. In that case, let v R be a vertex that belongs to S r(x) ∪ V r(x) , but does not belong to S r(x)−1 . Sequence p R is empty, so there is a vertex z l(x) that belongs to S a , but does not belong to S r(x) . Yet, again we can find an asteroidal triple {v L , v R , y} certified by paths: Finally, we are done with the classification of interval edges. For each edge (x, y) which is an interval edge, we provided a linear time algorithm that produces a string representation for the graph G − (x, y), see Lemmas 9, 11, 12, 13, and 14. Moreover, for every edge (x, y) that is not an interval edge we presented structures certifying that G − (x, y) is not an interval graph, see Lemmas 8,10,15,16,17,21 and 22. The consequence of all those lemmas is the following theorem.
Theorem 23 There is a linear time algorithm, that for every MPQ-tree T representing graph G, and every interval edge (x, y), produces a string representation S ′ for the graph G − (x, y).

Listing interval edges
In this section we present an efficient algorithm that for a given MPQ-tree T lists all interval edges of the graph represented by T . Let S 1 , . . . , S k be the sections of a Q-node Q. For b ∈ {2, . . . , k}, denote f r (b) the maximal index of a section such that . For every vertex x which belongs to Q, and every l(x) a r(x) let: In other words, if S a = {x}, then L * (x, a) = i if S i is the rightmost section such that there is a vertex v = x which belongs to S a and v has its left endpoint in S i . Now, we are ready to express the inclusion conditions on Q-node sections in terms of the functions f l , f r , L * , and R * .
Observation 24 In respect to the above definitions, we have the following equivalences: Using those equivalences, we are able to reformulate the conditions of Lemmas 13 and 14.
Observation 25 For an x, y -tree-path that starts in a central section S a , the conditions (1) Hence, the only thing we need to show is S a {x} ⊂ S b . According to Observation 24 it is equivalent to b ∈ [L * (x, a), R * (x, a)]. It is easy to see that for every x and a we have L * (x, a) R * (x, a). Thus, the interval [L * (x, a), R * (x, a)] is never empty. If b = R * (x, a), then we are done, so assume that b = l(x). But, in this case L * (x, a) l(x) = b R * (x, a), and we are done too. ✷ A very similar proof applies to the following observation, so we leave it to the reader.

Observation 26
For an x, y -tree-path that starts in a central section S a , the conditions (1) Observations 25 and 26 provide fast and easy tests under the assumption that all the functions l, r, f l , f r , L * and R * are already computed. To represent functions l, r, f l and f r in computer's memory we use O(n)-element arrays of integers. Functions L * and R * in their explicit forms may require O n 2 space. Hence, for performance purposes, we do not represent those functions as two-dimensional arrays. Instead, we observe that the function L * can be defined using some one-dimensional functions L 1 and L 2 . We set L 1 (a) = max {l(v) : v ∈ S a }, and denote v 1 (a) a vertex for which l(v 1 (a)) = L 1 (a). We also define L 2 (a) = max {l(v) : v ∈ S a {v 1 (a)}}, or L 2 (a) = 1 if S a = {v 1 (a)}. Using those two functions we are able to compute the function L * in the following way: Analogously, we can represent the function R * using two functions R 1 and R 2 . Now we are ready to show the interval edges enumeration algorithm.
Lemma 27 Functions l, r, f l and f r for all Q-nodes of the tree T can be computed in O(n log n) time.
Proof: We compute these functions for each Q-node separately. Assume that we are computing the function f r for a Q-node Q d . Let i be the minimum index of the section containing a right endpoint of some vertex from . Hence, f r (b) = i, and in order to compute the function f r for all b, it is enough to scan the sections of Q d from left to right maintaining a heap of right endpoints. When algorithm enters the section S b+1 it adds to the heap all right endpoints of vertices that have its left endpoint in S b , assigns f r (b) to be the minimum value stored in the heap, and removes all the endpoints of vertices that have its right endpoint in S b . Thus, the computation of the function f r for Q d takes O(n d log n d ) time, where n d denotes the number of vertices in Q d . As n d n, the computation of all functions f r takes no more than O(n log n) time. A similar argument applies to the functions f l . ✷ Lemma 28 Functions L 1 , L 2 , R 1 and R 2 for all Q-nodes of the tree T can be computed in O(n log n) time.
Proof: The proof is very similar to the proof of Lemma 27. Yet again, we use a heap of right or left endpoints, but now we are not only interested in the minimal element but also in the second one. ✷

Theorem 29
There is an algorithm that for a given MPQ-tree T lists all its interval edges in O(max {n + m, n log n}) time.
Proof: The algorithm is pretty straightforward. At first, we compute all the functions l, r, f l , f r , L 1 , L 2 , R 1 and R 2 . Then, we inspect all P-nodes and all sections of Q-nodes listing all edges (x, y) that satisfy the conditions of Lemmas 9 or 11. For a P-node that is a leaf, we list all pairs (v a , v b ) for a = b, while for the section S i with subtree that is either empty or is a P-node with no children, we list the edges of the form (v L , v R ), where v L is a vertex that has its right endpoint in S i , and v R is a vertex that has its left endpoint in S i . Note that, an MPQ-tree has no more than O(n) nodes and sections. Moreover, we have a constant time access to all vertices v L and v R . Thus, this phase works in O(n + m). Now, we want to find all interval edges (x, y) such that x and y belong to different nodes in T , and x is over y. Lemmas 15 and 16 imply that it is enough to consider only those pair of vertices (x, y), where y belongs to a leaf of T . Hence, for each leaf L of a tree T , we traverse a unique path between L and the root of T , starting from L, and listing edges of the form (x, y), where x belongs to the currently visited node, and y belongs to L. We do not list all such edges, but for each candidate we need to decide whether (x, y) is an interval edge or not. In order to do it efficiently, we keep two boolean variables: 1. does y have a neighbor in the visited subtree, and 2. does the path go through some central section. Using those two variables and precomputed functions, we can decide whether (x, y) is an interval edge in a constant time thanks to Lemma 12, and Observations 25 and 26. Thus, the time spent by the algorithm in this phase is bounded from above by the sum of lengths of all paths we have visited plus the number of tested edges. Lemma 3g, implies that on those paths there are no two consecutive empty P-nodes, so we can bound the sum of lengths of those paths by O(m). Thus, the time spent by the algorithm in this phase is O(n + m), and the whole algorithm works in O(max {n + m, n log n}) time. ✷

Parent-Child Relationship
In this section we present the graph enumeration algorithm. We define a parent-child relationship in the same way as authors in Yamazaki et al. (2019) did using the following lemma.
Lemma 30 (Kiyomi et al. (2006)) If G = (V, E) is an interval graph which is not a clique, then there is at least one edge e ∈ E such that G + e is also an interval graph.
Theorem 31 (Yamazaki et al. (2019) Thm. 5) Let G = (V, E) be any interval graph. Then its parent can be computed in O(n + m) time. Yamazaki et al. used Lemma 30 and defined the parent of G to be a graph G + e such that G + e is an interval graph and e is lexicographically the smallest possible. They proved that for every interval graph G its parent can be computed in O(n + m) time -see Theorem 31. Thanks to the fact that we work with MPQ-trees and string representations, we are able to get rid of the O(m) factor using the algorithm from Theorem 1.
Theorem 32 There is a linear time algorithm that for every canonical MPQ-tree T representing an interval graph G that is not a clique, produces a string representation S ′ of a graph G + e, where e is the lexicographically smallest edge.
Proof: Let S be the canonical string for T . Let 12...j be the longest prefix of S such that j...21 is a suffix of S. Clearly, such prefix can be found in O(n) time. Moreover, all vertices 1, . . . , j have degree n − 1 in the graph G. Hence there is no pair (x, y) / ∈ E such that x ∈ {1, . . . , j}. We prove that there is a pair (j + 1, y) for some y j + 2 such that G + (j + 1, y) is an interval graph. Let y be the leftmost endpoint of an interval that is to the right of the right endpoint of j + 1. If such y does not exist, then to the right of the right endpoint of j + 1 there are only right endpoints. Hence, G is a clique and we reached a contradiction. Thus, y exists, (j + 1, k) is an edge for all k y, and there is no edge between j + 1 and y. So, G + (j + 1, y) is the parent of G. In order to produce a string representation for the graph G + (j + 1, y), we move the right endpoint of j + 1 to the right until it passes the left endpoint of y. Lemma 7 guarantees that no edge except (j + 1, y) was added. ✷ Finally, we take all the pieces together and present our main result.
Theorem 33 Let T be a canonical MPQ-tree representing a non-empty (m 1) interval graph G. The set of canonical trees for children of G in the family tree F n can be computed in O(nm log n) time.
Proof: At first, we list all interval edges for the tree T in O(max {n + m, n log n}) time, see Theorem 29. Then, for each interval edge e, we produce a string representation S ′ of G − e in linear time, build MPQ-tree T ′ for the interval graph represented by S ′ in O(n), and finally compute the canonical form of T ′ in O(n log n) time, see Theorems 23, 1, and 5. Hence, we compute all canonical strings for children candidates in O(nm log n) time. Theorem 4 implies that in order to check isomorphism, it is enough to remove duplicates from this set. It can be easily done by storing all computed strings in a trie. Finally, we need to filter out those graphs for which G is not a parent. For each candidate canonical string, we compute its parent string in O(n) time, see Theorem 32, build a canonical MPQ-tree in O(n log n) time and check whether its canonical string equals with a canonical string for the graph G in O(n) time. Thus, we filter out non-children in O(nm log n) time, and the whole process takes O(nm log n) time. ✷

Performance
In the previous section we presented theoretical analysis of our enumeration algorithm. In this section we present two lemmas, that helped us to significantly speedup the execution of the algorithm. Unfortunately, presented tricks do not improve the worst-case time delay, and it is quite easy to show an MPQ-tree that even with those tricks take O(nm log n) time to process. We leave it as an exercise.
Proof: One can easily check that the function f : V → V such that f (v 1 ) = v 2 , f (v 2 ) = v 1 and f identifies other vertices, encodes an isomorphism between G − (v 1 , y) and G − (v 2 , y). ✷ A consequence of the above lemma is the fact that if a P-node contains more than one vertex namely v 1 , . . . , v j , then graphs G − (v 1 , y) and G − (v a , y) for every a > 1 are isomorphic. Thus, when listing potential candidates for the children of the graph G, we may omit all edges of the form (v a , y) for a > 1 and list only the edges of the form (v 1 , y). The same argument applies to a Q-node and vertices that belong to the same sections.

Lemma 35
Let v 1 , . . . , v k be a subset of vertices of the graph G = (V, E) such that ∀ i =j : N (v i ) {v j } = N (v j ) {v i }, and v 1 , . . . , v k form a clique in G. All graphs G i,j = G − (v i , v j ) are pairwise isomorphic.
Proof: Consider two graphs G i,j and G i ′ ,j ′ and a function f : For the other vertices f is an identity. ✷ A consequence of this lemma is the fact that if a P-node contains more than 2 vertices, then we may omit all the edges between them, except (v 1 , v 2 ). The same applies to the vertices that occupy the same sections of a Q-node. Both presented optimizations do not improve the worst case complexity of our algorithm, but significantly speed it up.