Abstract 1 Introduction 2 Preliminaries and split decomposition 3 Circle graphs and split PC-trees 4 Lexicographic Breadth-First-Search 5 The vertex insertion algorithm References

Circle Graphs Can Be Recognized in Linear Time

Christophe Paul ORCID CNRS, Université Montpellier, France Ignaz Rutter ORCID University of Passau, Germany
Abstract

To date, the best circle graph recognition algorithm, due to Gioan et al. [19] runs in almost linear time as it relies on a split decomposition algorithm [20] that uses the union-find data-structure [16, 34]. We show that in the case of circle graphs, the PC-tree data-structure [31] allows one to avoid the union-find data-structure to compute the split decomposition in linear time. As a consequence, we obtain the first linear-time recognition algorithm for circle graphs.

Keywords and phrases:
graph classes, circle graphs, graph algorithms
Funding:
Christophe Paul: Research supported by ANR-DFG project GODASse ANR-24-CE48-4377.
Copyright and License:
[Uncaptioned image] © Christophe Paul and Ignaz Rutter; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Graph algorithms
; Mathematics of computing Combinatorial algorithms ; Mathematics of computing Graph theory ; Theory of computation Data structures design and analysis ; Theory of computation Graph algorithms analysis
Related Version:
Full Version: https://arxiv.org/abs/2512.23492
Editors:
Meena Mahajan, Florin Manea, Annabelle McIver, and Nguyễn Kim Thắng

1 Introduction

A circle graph is the intersection graph of a set of chords inscribed in a circle, called chord diagram (see Figure 1 below for an example).

Figure 1: The House graph on the left and its chord diagram on the right.

Since their introduction in the early 70’s, circle graphs have been extensively studied. They were first defined by Even and Itai [12], who proved that the minimum number of parallel stacks needed to sort a permutation equals the chromatic number of a circle graph. Independently, Bouchet [1] studied alternance graphs to provide an algorithmic solution of the Gauss problem on self-intersection curves in the plane. A double occurrence word on a set L of letters is a word containing exactly two copies of every letter of L. An alternance graph is defined by a double occurrence word on its set of vertices such that two vertices are adjacent if and only if their occurrences alternate in the word (see Subsection 3.1). It is easy to see that alternance graphs are exactly circle graphs. A first characterization of circle graphs was proposed by Fournier [14] in terms of ordered sets, while De Fraysseix [11] characterized circle graphs as intersection graphs of co-cyclic paths. As confirmed by recent results, circle graphs play a very important role in the theory of vertex minors (see [27]). A local-complementation consists in replacing in a graph the neighborhood of a vertex by its complement graph. A vertex-minor of a graph G is a graph H that can be obtained from G by a series of local complementations and vertex deletions. It is easy to see from a chord diagram that every vertex-minor of a circle graph is itself a vertex minor (this was first noticed by Kotzig [24] in a series of seminars). Bouchet [3] showed that a graph is a circle graph if and only if it excludes one of the three graphs of Figure 2 as a vertex-minor. It is conjectured that the vertex-minor relation forms a well-quasi-ordering (see [27]). To tackle this question, the rank-width parameter has been introduced as the analog, for vertex-minor relation, of the tree-width for the minor relation [29]. It turns out that circle graphs play the same role for the rank-width parameter, as planar graphs for treewidth. Indeed Geelen et al. [17] recently proved an analog of the grid minor exclusion theorem [28]: a graph has bounded rank-width if and only if it excludes as a vertex minor a sufficiently large comparability grid111For a positive integer n, the n×n-comparability grid is the graph with vertex set {(i,j)i,j{1,2,,n}} such that vertices (i,j) and (i,j) are adjacent if either ii and jj, or ii and jj.. In the same way as every planar graph is a minor of a large enough grid, every circle graph is a vertex minor of a sufficiently large comparability grid.

Figure 2: The vertex minor obstructions of circle graphs: W5, the wheel of 5 vertices, F7 and W7.

As pointed out in [2], neither Fournier’s nor de Fraysseix’s characterization yields a polynomial-time recognition algorithm for circle graph. It took about 15 years for the first recognition algorithm to appear. Actually, three polynomial-time recognition algorithms were independently obtained in the mid 80’s by Naji [26], by Gabor et al. [15], and by Bouchet [2], respectively. Each of these three algorithms involves the split decomposition of graphs, introduced by Cunningham and Edmonds [8]. Indeed, they all reduce the circle graph recognition problem to prime graphs, that is, graphs that are indecomposable with respect to the split decomposition. The O(n7)-time algorithm of Naji [26] relies on the resolution of a system of linear equations that characterizes prime circle graphs. Bouchet’s algorithm [2] runs in O(n5)-time and uses the property that every prime circle graph on n vertices contains as a vertex minor a prime circle graph on n1 vertices. The complexity of the algorithm of Gabor et al. is O(n3). It relies on the property that prime circle graphs have a unique chord diagram, a property that was formally proved only later (see [2, 7, 19]). The complexity of the circle graph recognition was later improved down to O(n2)-time by Spinrad [33]. This was possible by the use of a novel O(n2)-time algorithm to compute the split decomposition of a graph due to Ma and Spinrad [25]. We observe that the linear-time split decomposition algorithm later obtained by Dahlhaus [9, 10] has no impact on the complexity of Spinrad’s circle graph recognition algorithm. The reason is that Spinrad’s algorithm is a vertex-incremental algorithm, while Dahlhaus’ is not. Finally, until very recently no subquadratic time circle graph recognition algorithm was known. Gioan et al. [20, 19] broke the quadratic barrier by designing a novel almost linear-time split decomposition algorithm and showed how to apply that algorithm for the circle graph recognition problem. Their algorithm uses an important property of the last vertex of a Lexicographic Breadth-First-Search (LexBFS) [30] with respect to the split-decomposition. In the case of circle graphs that property translates to the existence of a chord diagram where the neighborhood of the last LexBFS vertex appears consecutively (see Lemma 12). This allows Gioan et al. to design a LexBFS-based algorithm that incrementally updates the split decomposition and the corresponding representation of circle graphs. The hurdle to linear time complexity in the algorithm of Gioan et al. is the use of the union-find data-structure [16, 34] to update the parent-children relationships in the modified split decomposition. The resulting time complexity is O((n+m)α(n,m)), where α() is the slowly growing inverse of the Ackermann function.

Our result.

Gioan et al. [19] left open the question of the existence of a linear-time circle graph recognition algorithm. To resolve that question, we show that the consecutive property of the neighborhood of the last vertex of a LexBFS ordering allows us to use a PC-tree data-structure [31] (see also [21, 13]) rather than the union-find data-structure. As a consequence, we shave the α(n,m) factor in the time complexity of Gioan et al.’s algorithm, yielding the first linear-time circle graph recognition algorithm.

An intriguing question that remains open is whether the LexBFS incremental split decomposition algorithm could also be turned into a linear time algorithm. But to circumvent the use of the union-find data-structure, in that case, we are still missing a generalization of good vertex lemma providing a consecutive property.

This has implications for other problems, where linear time was achieved only under the assumption that a representation of the input is provided. This includes the isomorphism problem for circle graphs [23] as well as the partial representation extension problem [4], where one is given a chord diagram for an induced subgraph of the input graph and seeks to extend it to a representation of the full graph. In addition, it may have pave the way for a new linear-time recognition algorithm of circular-arc graphs that follows Hsu’s approach [22].

Organization of the paper.

Section 2 introduces the basic definitions and presents the model of graph labelled trees (GLT) proposed by [18, 20] to represent the split decomposition of a graph. Section 3 is dedicated to circle graphs, their chord diagrams, the data-structures we use to store a circle graph. The GLT representing the split decomposition tree is implemented by a PC-tree [21, 13], and the chord diagrams representing the prime nodes are encoded by Consistent Symmetric Cycles [19]. Section 4 describes LexBFS and corresponding properties of circle graphs, including an alternative proof of the good vertex lemma. The original proof of Gioan et al. [19] was two-steps: it first proved the property for prime circle graphs and then the general case follows as a consequence of the recognition algorithm. Our proof is independent of the recognition algorithm. Finally, in Section 5, we present how to adapt the circle graph recognition of Gioan et al. [19] to the new data-structure. The algorithm checks if a vertex ending a LexBFS can be inserted in the split PC-tree of a circle graph and if so updates the split PC-tree representation. Along with the correctness proof, we provide an amortized time complexity analysis based on the method of potentials [32] (see also [5, Ch. 17.3]). Interestingly, we observe that this complexity analysis also applies to the original algorithm [19], and to the split decomposition algorithm [20] as well, and simplifies the complexity therein.

2 Preliminaries and split decomposition

2.1 Basic definitions

A word over an alphabet Σ is a finite sequence of letters of Σ. If A is a word over Σ, then Ar denotes its reversal (the ordering between the letters of A has been reversed). The concatenation between two words A and B over Σ is a word over Σ denoted AB. A subsequence F of consecutive letters in a word A is called a factor of A.

A circular word C over Σ is a circular sequence of letters of Σ. It can be represented by a word by considering that the first letter follows the last letter. Observe that such a representation fixes an arbitrary first letter. So if a circular word C is represented by the word AB, then BA also represents C. To denote that equivalence, we write CABBA. Observe that, if C a circular word represented by the word A, that is CA, then the reversal of C is CrAr. The notion of factor naturally extends to circular words: F is a factor of C if there exists a word A such that CA and F is a factor of A.

Unless specified, we will assume that every graph G=(V,E), on vertex set V and edge set E, is connected. The neighborhood of a vertex x in G will be denoted NG(x) or simply N(x) if the graph is clear from the context. A clique is a graph where every vertex is adjacent to every other vertex. A star is a tree with one universal vertex. For a graph G=(V,E) and a vertex x not belonging to V, we let denote G=G+x 222Though the neighborhood of x is not specified in the notation G+x, it will always be clear from the context. the graph obtained by adding x to V and all the edges between x and NG(x) to E. Given a subset S of vertices of V, we let G[S] denote the subgraph induced by S. A vertex ordering σ is a total order on the vertices of a graph G. If x is smaller than y in σ, we write x<σy. For a subset S of vertices, we let σ[S] denote the subordering of σ induced by the vertices of S, that is for every x,yS, x<σ[S]y if and only if x<σy.

2.2 Split decomposition and graph labelled trees

A bipartition (A,B) of a set V is non-trivial if |A|>1, |B|>1.

Definition 1 (Split of a graph).

A split of a graph G=(V,E) is a non-trivial bipartition (A,B) of its vertex set V with two subsets AA, BB, called frontiers of the split, such that for every xA and yB, it holds that xyE if and only if xA and yB.

Splitting a graph G with respect to a split (A,B) of G returns two graphs GA and GB obtained from G by contracting B into a vertex xA and A into a vertex xB (the neighborhood of xA in GA is A and of xB in GB is B), respectively. Let G=(V,E) and G=(V,E) be two graphs and let xV and xV be two vertices. The join between G and G with respect to x and x, denoted (G,x)(G,x), is the graph on vertex set (VV){x,x} such that two vertices y and z are adjacent if and only if yzE, or yzE, or yNG(x) and zNG(x). So the join and the splitting are reverse operations for large enough graphs. Observe that if G is the single vertex graph, then (G,x)(G,x) is isomorphic to G[V{x}], and if G is the clique of size 2, then (G,x)(G,x) is isomorphic to G Otherwise, if G and G are connected, then (V{x},V{x}) is a split of (G,x)(G,x). A graph G is degenerate if every non-trivial bipartition of V is a split of G. It is known that if G is degenerate, then G is either a clique or a star. A graph G is prime if it does not contain any split.

Definition 2 (Graph labelled tree).

A graph labelled tree (GLT) is a pair (T,), where T is a tree and a set of graphs, called label graphs, such that each node u of T is labelled by the graph G(u) and is further equipped with a bijection ρu that bijectively maps the edges incident to u to the vertices of G(u).

Let (T,) be a GLT and let u be a node of (T,). We say that the node u is prime if G(u) is a prime graph and that u is degenerate if G(u) is degenerate. We let V(u) denote the vertices of G(u), hereafter called marker vertices, and E(u) denote the edges of G(u), hereafter called label edges. Since a leaf has only one incident edge, we may abusively consider leaves as marker vertices (namely the leaf u is identified with the marker ρu(e), of the unique edge e incident to u). If e=uv is a tree-edge of T, then the marker vertices ρu(e) and ρv(e) are opposite marker vertices called the extremities of e. Observe that every marker vertex is the extremity of a tree-edge of T.

A graph labelled tree is designed to represent a graph in a compact manner. To explain how, we need to introduce the notion of accessibility, which can be seen as an extension of the adjacency. Two marker vertices q and q of distinct nodes are accessible from one another if there exists a sequence of marker vertices q=q1,,q2k=q of even length such that qi,qi+1 are the extremities of a tree-edge if i is odd and are adjacent marker vertices in some label graph if i is even.

Let e=uu be a tree-edge of the GLT (T,). Consider the marker vertex qV(u) that is the extremity e. Then, we let L(q) denote the set of leaves of the subtree of Te not containing u. Among L(q), we distinguish the subset A(q) of leaves accessible from q.

Definition 3 (Accessiblity graph).

The accessibility graph 𝖦𝗋(T,) of a GLT (T,) is the graph whose vertices are the leaves of T and such that two vertices are adjacent if and only if the corresponding leaves are accessible from one another.

Let qV(u) be the extremity of e distinct from q. We observe that if e is not incident to a leaf of T, then the bipartition (L(q),L(q)) is a split of 𝖦𝗋(T,) and the frontiers of that split are A(q) and A(q). The node-join of two non-leaf nodes u and u in (T,) returns the GLT (T,) obtained by contracting the tree-edge e=uu, labelling the resulting node v by the graph G(v)=(G(u),q)(G(u),q), and letting every marker vertex qV(v) be the extremity of the same tree-edge as in (T,). The node-split operation of a GLT is the reverse of the node-join operation. Suppose that (A,B) is a split of the graph G(u) for some node u of (T,). The node-split of u with respect to (A,B) returns the GLT (T,) where node u has been replaced by two adjacent nodes uA and uB labelled by G(uA)=G(u)[A{qA}] for some vertex qA of the frontier B and G(uB)=G(u)[B{qB}] for some vertex qB of the frontier A, respectively. The marker vertices qAV(uA) and qBV(uB) are made the extremities of the tree-edge uAuB. Every other marker vertex is an extremity of the same tree-edge as in (T,).

Theorem 4 ([8, 20]).

For any connected graph G, there exists a unique GLT, denoted 𝐒𝐓(G) and called the split-tree of G, whose labels are either prime or degenerate, having a minimum number of nodes and such that 𝖦𝗋(𝐒𝐓(G))=G.

3 Circle graphs and split PC-trees

3.1 Chord diagrams and circle graphs

A chord on a circle is defined by a pair c={c1,c2} of distinct points of the circle, called endpoints. Let χ be a set of chords no pair of which share a common endpoint. An expanded chord diagram on χ is naturally represented by a circular word D˙ over the alphabet 𝒱=cχ{c1,c2}. A chord diagram D is obtained from the expanded chord diagram D˙ by replacing every endpoint ci𝒱 (i{1,2}) by the corresponding chord cχ. Observe that a chord diagram D is a double occurrence circular word over the alphabet χ, that is every chord of χ appears exactly twice in D. We may abusively say that each occurrence of a chord c in D is an endpoint of c. A subset S of chords of χ is consecutive in D if D contains a factor F such that for every chord cS, |cF|=1 and for every chord cS, cF=. The first and the last chord of the factor F are called the bookends of F (or of S). Let a and b be two endpoints of the chord diagram D. Then D(a,b) is the factor of D containing the set of endpoints comprised between a and b (not containing a and b), while D(b,a) contains those comprised between b and a. In other words, we have that DaD(a,b)bD(b,a). Observe that D(a,b)r=Dr(b,a) and that D(b,a)r=Dr(a,b).

Let D and D be chord diagrams on χ and χ, respectively, and let xχ and xχ. We define the circle-join operation between D and D with respect to x={x1,x2} and x={x1,x2} as follows:

(D,x)(D,x)D(x1,x2)D(x1,x2)D(x2,x1)D(x2,x1)

The result is a chord diagram on the set (χχ){x,x} (see Figure 3). We observe that the circle-join is not a commutative operation: (D,x)(D,x)(D,x)(D,x).

Figure 3: From left to right: the chord diagram D1 of the house graph H, the chord diagram D2 of the C5 and D1(a)D2(a)=D1(a1,a2)D2(a1,a2)D1(a2,a1)D2(a2,a1), the chord diagram of the graph G=(H,a)(C5,a) (depicted on the right). Dotted chords represent the vertices (respectively a and a) on which the join is performed. In G, vertices b and c (the neighbors of a in the House graph) are both adjacent to vertices b and c (the neighbors of a in the C5).
Lemma 5 ([19, Lemma 3.3]).

Let D and D be chord diagrams on the sets V and V of chords, respectively. Let SV and SV be consecutive sets of chords in their respective chord diagrams such that 1<|S|<|V| and 1<|S|<|V|. If x and x are bookends of S and S, respectively, then X=(S{x})(S{x}) is consecutive in (at least) one of the following chord diagrams:

(D,x)(D,x),(D,x)(D,x),(D,x)(Dr,x),(Dr,x)(D,x).

Moreover, the bookends of X are those of S and S distinct from x and x.

A circle graph G=(V,E) is the intersection graph of a chord diagram D on a set χ of chords of a circle. In other words, there exists a bijection ρ:Vχ such that two vertices x,yV are adjacent in G if and only if the chords ρ(x) and ρ(y) intersect in D, that is if and only D(x1,x2) contains one endpoint among y1 and y2 and D(x2,x1) the other. We say that D represents or encodes G. We observe that, in general, a circle graph is encoded by many different chord diagrams. For example, cliques and stars are circle graphs that are represented by many chord diagrams: every clique G on vertex set V is represented by DAAr where A is an arbitrary permutation of V; every star G with center vertex x is represented by DxAxA where A is an arbitrary permutation of V{x}.

Observation 6.

Let G and G be two circle graphs represented by chord diagrams D and D, respectively. Then, for any vertex x of G and any vertex x of G, the chord diagrams (D,x)(D,x) and (D,x)(D,x) represent the circle graph H=(G,x)(G,x).

However, we have the following important property, announced in [15], partially proved in [2], formally proved in [7] (an alternative proof was given in [19]):

Theorem 7 ([15, 2, 7, 19]).

A circle graph G=(V,E) is a prime graph if and only if it has a unique (up to reversal) chord diagram.

Since degenerate graphs (cliques and stars) are circle graphs, a consequence of Observation 6 is the following well-known characterization of circle graphs.

Theorem 8 ([15, 2, 26]).

A graph G is a circle graph if and only if every prime node u of 𝐒𝐓(G) is labelled by a circle graph G(u).

3.2 Consistent symmetric cycles

We describe the consistent symmetric cycle data-structure (CSC) introduced in [19] that represents chord diagrams and allows to efficiently perform the following operations: consecutive test (see Lemma 9), consecutive preserving join (see Lemma 10) and vertex insertion (see Lemma 11). Let D be a chord diagram on the set χ of chords. The consistent symmetric cycle (CSC), denoted 𝐂(D), representing D is a directed graph whose vertices are the chord endpoints of χ, that is μ=xχ{x1,x2}. Every pair of consecutive endpoints in D is linked by two symmetric arcs, hence forming a symmetric directed cycle. It follows that every endpoint has two out-neighbors, which we denote +𝐂(D)() and 𝐂(D)(). For every chord x we have the property +𝐂(D)(x1) and +𝐂(D)(x2) belong to one of the two connected components of 𝐂(D){x1,x2} and 𝐂(D)(x1) and 𝐂(D)(x2) to the other. To complete 𝐂(D), the two endpoints of every chord are linked with symmetric arcs (see Figure 4).

Figure 4: The house graph on the left. On the right, the CSC 𝐂(D) of the (unique) chord diagram D of the house graph (drawn in the middle). The dashed arc leaving an endpoint x represents +𝐂(D)(x) and the dotted arc represents 𝐂(D)(x). For example, 𝐂(D)(a)=e and +𝐂(D)(a)=c.

Let 𝐂(D) be a CSC on the set χ of chords. Let x1 and x2 be the two endpoints of a chord x. We let +𝐂(D)(x1,x2) denote the factor of 𝐂(D) obtained by searching 𝐂(D) from +𝐂(D)(x1) to +𝐂(D)(x2). The factor 𝐂(D)(x1,x2) is defined similarly. In the example of Figure 4, we have +𝐂(D)(e1,e2)=c2d1a1b1c1a2 and 𝐂(D)(e1,e2)=d2b2. We observe that +𝐂(D)(x1,x2)=+𝐂(D)(x2,x1)r and that either +𝐂(D)(x1,x2)=D(x1,x2) or +𝐂(D)(x1,x2)=Dr(x1,x2).

The following three lemmas state the complexity of basic operations on CSC’s that the algorithm has to perform. Their proofs are straightforward from the data-structure description of CSC’s. They have been formally discussed in [19] as Lemmas 5.5–5.7.

Lemma 9 (Consecutivity test).

Let D be a chord diagram of a circle graph G=(V,E). Given a subset S of vertices of G and 𝐂(D) the CSC representing D, we can test in O(|S|)-time if S is consecutive in D.

Lemma 10 (Consecutivity preserving join).

Let D and D be chord diagrams of the circle graphs G=(V,E) and G=(V,E), respectively, and let S and S be consecutive chords in D and D, respectively. Let further x and y denote the bookends of S, and x and y the bookends of S, and 𝐂(D) and 𝐂(D) the CSCs representing D and D. Then a CSC representing a chord diagram of (G,x)(G,x) such that (S{x})(S{x}) is consecutive and has bookends y and y can be computed in O(1) time.

Lemma 11 (Chord insertion).

Let D be a chord diagram of a circle graph G=(V,E) and let S be a subset of vertices of G that is consecutive in D. Given 𝐂(D) the CSC representing D and the bookends b and b of the factor of D certifying that S is consecutive, a CSC of G+x where the neighborhood of x is S can be computed in O(1) time.

3.3 PC-trees

The data structure we use to encode the split-tree 𝐒𝐓(G) of a circle graph G is based on PC-trees [21, 13]. We call it the split PC-tree of G and it is denoted 𝐏𝐂(G) (see Figure 5 for an example). It stores all marker vertices of 𝐒𝐓(G) and encodes the structure of 𝐒𝐓(G) on top of them as follows. We select an arbitrary leaf of 𝐒𝐓(G) as the root of 𝐏𝐂(G), which we denote by r. Let u be a node of the split-tree 𝐒𝐓(G). For each marker vertex qV(u), we store an outgoing arc to its opposite q, which is a marker vertex of G(u) for some node u adjacent to u in 𝐒𝐓(G). Observe that this way, each tree-edge e of 𝐒𝐓(G) corresponds to a pair of oppositely oriented arcs. We assume moreover that for an arc a of 𝐏𝐂(G), the opposite arc, denoted a¯, can be accessed in O(1)-time. The way marker vertices of V(u) are stored depends on the type of the node u in 𝐒𝐓(G).

  • Suppose u is degenerate. Then u is represented in 𝐏𝐂(G) by a node object 𝐧(u) that stores (i) the type of u, (ii) a (doubly-linked) list 𝐋(u) of the marker vertices in V(u) (iii) a pointer to the node of V(u) whose arc points towards the root r, and (iv) in case u is a star, a pointer to the marker vertex that is the center of the star. Further, each marker vertex of V(u) is equipped with a pointer to the node object 𝐧(u).

  • Suppose u is not degenerate. Then 𝐏𝐂(G) does not store any node object for u. Instead, the vertices of V(u) are stored in a CSC 𝐂(u) representing a chord diagram of G(u). For each vertex xV(u), one of the two endpoints of the corresponding chord is made incident to the symmetric pointers representing the tree-edge e of which x is the extremity. Further, a flag is used to mark the vertex whose arc points towards the root r of 𝐒𝐓(G).

Figure 5: A circle graph G, a chord diagram of G and the split PC-tree 𝐏𝐂(G) rooted at leaf 1. The red plain arcs correspond to the tree-edges from nodes to their parent. The split-tree 𝐒𝐓(G) contains a unique prime node u labelled by the house graph and represented by a CSC. The root of a node u is the extremity of the arcs between u and its parent. Roots are marker vertices or the endpoints colored red. Every marker vertex of a degenerate node has a pointer towards its root. In a star node u, the center is identified by a blue star (which can be distinct from the root of u).

Observe that, given any marker vertex from V(u) of some degenerate node u, we can determine the corresponding node object and thus also its parent arc in O(1) time. On the other hand, due to the lack of a node object to represent a non-degenerate node u, finding the parent arc of u is a costly operation. Indeed, given a marker vertex from V(u), one has to traverse 𝐂(u) until the endpoint is found whose flag indicates that it is incident to the parent arc. On the positive side, by Lemma 10, given two CSC’s, it is possible to perform a node-join operation in O(1) time and since the result is always a non-degenerate node, there is no need to update pointers to a node object, especially the pointer to the parent of the resulting node.

4 Lexicographic Breadth-First-Search

The algorithm LexBFS (Lexicographic Breadth-First-Search) was introduced by Rose, Tarjan and Lueker [30] to recognize chordal graphs in linear time. It has since been used in many different contexts. We refer to [20] and references therein for a description of LexBFS. The circle graph recognition algorithm uses LexBFS as a preprocessing step to compute an ordering of the vertices of the input graph G. That ordering is then used to incrementally build 𝐏𝐂(G) if G is a circle graph by adding one vertex at a time.

A LexBFS ordering of a graph G is an ordering σ in which LexBFS has visited the vertices of G. Let y be a vertex of G. The slice S(y) is the largest factor of σ starting at y such that for every xσy, x is adjacent to y if and only if x is adjacent to every vertex of S(y). It is known that the restriction σ[S(y)] to the vertices of the slice S(y) is a LexBFS ordering of G[S(y)] [6]. A vertex x of a graph G is good if there exists a LexBFS ordering σ whose last vertex is x. Due to the following lemma, good vertices are crucial to the LexBFS incremental recognition algorithm of circle graphs. This lemma is stated and proved in [19] for the case of prime graphs. The case of arbitrary graph follows from the algorithm of [19]. We provide a self-contained proof independent from their algorithm.

Lemma 12 (Good vertex lemma).

Let G be a circle graph. If x is a good vertex of G, then G has a chord diagram D in which N(x) is consecutive.

Proof.

Let σ be a LexBFS ordering of G ending at x. Let z and z be the first two vertices of σ in order. We prove the statement by induction on the number of slices containing x. Without loss of generality, we may assume that G is connected.

Suppose that for every vertex w{z,z,x}, S(w) is not a slice containing x. For the sake of contradiction, assume that N(x) is not consecutive in any chord diagram of G=(V,E). Observe that in every chord diagram D, either one endpoint of z appears in D(x1,x2) and the other in D(x2,x1), or the two endpoints of z appear in one of D(x1,x2) and D(x2,x1). Without loss of generality, suppose that D(x1,x2) contains at most one endpoint of z. Since N(x) is not consecutive, at least one chord has its two endpoints in D(x1,x2). Amongst such chords, let y be the one occurring the earliest in σ. Observe that by the choice of y, every neighbor v of y such that v<σy is adjacent to x. Since y<σx, we also have that every non-neighbor of v of y is a non-neighbor of x and thereby xS(y). Observe moreover that, by assumption on D(x1,x2), we have yz. It follows that if yz, we have a contradiction. So assume that y=z. Observe that by connectivity of G, we have that z is universal in G and thereby its chord has one endpoint in D(x1,x2) and the other in D(x2,x1). Then again, since N(x) is not consecutive, at least one chord has its two endpoints in D(x2,x1). Amongst such chords, let y be the one occurring the earliest in σ. By the same argument than before we can prove that S(y) is a slice containing x and moreover y{z,z,x}, which is a contradiction.

Let us assume the property holds if the last vertex of a LexBFS ordering belongs to k2 slices. Suppose that x belongs to k+1 slices of σ with k2. Let y be the vertex of G occurring last in σ such that y{z,z,x} and xS(y). If such a vertex does not exist, then by the discussion above we are done. Let us consider B={vVvσy} and A=S(y){y} where y is a neighbor of y such that y<σy. Observe that σ[B] and σ[A] are LexBFS orderings of G[B] and G[A] respectively ending at y and x. Since σ[B] has fewer slices containing y than σ has containing x, by the induction hypothesis, G[B] has a chord diagram DB in which N(y)B is consecutive. Also the only slices containing x in σ[A] are S(v)=A and S(x)={x}. Again by induction hypothesis, G[A] has a chord diagram DA in which N(x)A is consecutive. Hence, since y is universal in GA, we may assume that DA(x1,x2)=Xy2X certifies the consecutiveness of N(x)A. Observe then that DA(y1,y2)DB(y1,y2)=DA(y1,y2)DB(y1,y2)DA(y2,y1)DB(y2,y1) is a chord diagram of G in which N(x)=(N(x)A)(N(yB) is consecutive.

Let σ be a LexBFS ordering of a graph G and let u be a node of a GLT (T,) such that 𝖦𝗋(T,)=G. Then we can define from σ a LexBFS ordering σu of G(u) in the following way [20]: for two marker vertices q and q of G(u), let us denote x the earliest vertex of A(q) in σ and x the earliest vertex of A(q) in σ, then q<σuq if and only if x<σx.

Lemma 13 ([20]).

Let σ be a LexBFS ordering of a graph G and let u be a node of 𝐒𝐓(G). Then σu is a LexBFS ordering of G(u).

To illustrate Lemma 13, consider the graph G of Figure 5. The numbering of its vertices from 1 to 9 is a LexBFS ordering. Considering the unique prime node u of 𝐒𝐓(G), then σu=e,d,b,c,a is a LexBFS ordering of the house graph G(u).

Lemma 12, Lemma 13 together with Lemma 10 allows us to sketch a circle graph recognition algorithm. The idea is to iteratively process the vertices of an input graph G according to a LexBFS ordering in order to build 𝐏𝐂(G). By Lemma 12, at each step, if G is a circle graph, the neighborhood of the vertex x to be inserted is consecutive in some chord diagram of the so-far processed subgraph. By Lemma 13, this property is valid for the label graph of every node the current split PC-tree. Since adding a vertex may kill some existing split, we may have to perform node-join operations to compute the updated split PC-tree. By Lemma 10, this can be done while preserving the consecutiveness of the neighborhood of x. The challenge is to identify the part of the current split PC-tree that has to be shrunk into a single node. As we will see, either the input graph G is a circle graph and this can be done efficiently, or we are able to conclude that G is not a circle graph.

5 The vertex insertion algorithm

Throughout this section, we assume that G=(V,E) is a circle graph, that 𝐏𝐂(G) is the split PC-tree of G encoding its split-tree 𝐒𝐓(G)=(T,)333Given that we can transform 𝐒𝐓(G) into 𝐏𝐂(G) and vice versa, depending on the context, if more convenient we may abusively switch between these two objects.. We consider a new vertex x with neighborhood SV that is the last vertex of a LexBFS ordering of G=G+x, that is, x is good in the graph G. We assume without loss of generality that G is connected and S.

We let T(S) denote the minimal subtree of T that contains all vertices in S. Let q be a leaf of T or a marker vertex (possibly an endpoint) of some node u of T. Following the work of Gioan et al. [20, 19], the state of q (with respect to S) is perfect if SL(q)=A(q); empty if SL(q)=; and mixed otherwise (see Figure 6). We let P(u) denote the set of perfect marker vertices of u and MP(u) the set of perfect or mixed marker vertices of u. For a degenerate node u, we define:

P(u)={qV(u)q is perfect and not the center of a star},
E(u)={qV(u)q is empty, or q is perfect and the center of a star}.
Figure 6: A circle graph G=G+10 with vertex 10 being a good vertex of G adjacent to S={3,5,7,9}, a chord diagram of G and the split PC-tree 𝐏𝐂(G) marked with respect to {3,5,7,9}. Every marker vertex is assigned green tags: 𝖯 if it is perfect; 𝖬 if it is mixed; otherwise. The two green tree-edges are mixed and 𝐏𝐂(G) does not contain any hybrid node. Thereby endpoint e is marked empty since L(e)={1,4} does not intersect S; the endpoint a is marked perfect since L(a)={9}=A(a)S; and the endpoint c is marker mixed since L(c)={6,7,8}=A(c) while SL(c)A(c).

A node u of T is hybrid if every marker vertex q of u has the property that q is perfect or empty and its opposite is mixed. A tree-edge is mixed if both its extremities are mixed. It can be proved [20] that the subtree T of T defined by the mixed tree-edges is unique and connected, it is called the fully-mixed subtree of 𝐒𝐓(G). The following lemma is central to the correctness of the circle graph recognition algorithm:

Lemma 14 ([19]).

Let G=G+x be a prime graph such that x is a good vertex of G and G is a circle graph. Then G is a circle graph if and only if for every node u in 𝐒𝐓(G), marked with respect to NG(x), G(u) has a chord diagram in which MP(u) is consecutive, with the mixed marker vertices being bookends.

Let us discuss the above statement and provide some intuition of its correctness. First if G is a circle graph, then by Theorem 7, it has a chord diagram D, which is unique up to reversal. Since x is good, by Lemma 12, NG(x) is consecutive in D. Observe that NG(x) is still consecutive in the chord diagram D of G obtained by removing the chord x from D. However, G may not be a prime graph. If so we may retrieve the chord diagrams of every prime node of 𝐒𝐓(G) by performing a series of circle-split operations, the reverse operation of circle-join. When doing so, we can observe that the consecutive property is preserved as indicated in Lemma 14. Conversely, assume that every node of 𝐒𝐓(G) has a chord diagram satisfying the property stated in Lemma 14. Then by Lemma 5, iteratively performing for every tree-edge uv, a circle-join between the chord diagrams D(u) and D(v) with respect to the extremities of the tree-edge uv eventually returns a chord diagram D of G in which NG(x) is consecutive. It is then possible to insert in D a chord x crossing exactly NG(x), certifying that G=G+x is a circle graph.

As announced earlier, the recognition algorithm iteratively inserts vertices according to a LexBFS ordering. Of course, for the sake of time complexity, we cannot afford at each insertion step contracting 𝐒𝐓(G) in a single node. Lemma 14 allows us to maintain a chord diagram for each prime node providing local certificates of membership to the class of circle graphs.

5.1 Updating the split-tree

Gioan et al. [20, Theorem 4.14, Proposition 4.15–4.20] show that exactly one of the following cases occurs and in each case describe how to obtain the split-tree 𝐒𝐓(G), with G=G+x, from 𝐒𝐓(G)=(T,).

  1. 1.

    T contains a clique node u whose marker vertices are all perfect; or T contains a star node u whose marker vertices are all empty except its center, which is perfect; or T contains a unique hybrid node u, which is prime.

    In each of these cases, the node u is unique and the split-tree 𝐒𝐓(G) is obtained by adding to T a leaf x adjacent to u, adding to G(u) a new marker vertex qx adjacent to P(u) and opposite to x.

    We observe that the type of the updated node u is the same as in 𝐒𝐓(G). This implies that in the case u is degenerate, by Theorem 8, G+x is a circle graph. So let us discuss the case that u is a prime node. It is then represented in 𝐏𝐂(G) by a CSC 𝐂(u) encoding its chord diagram, which is unique. In 𝐂(u), for G+x to be a circle graph, MP(u) has to be consecutive with the mixed marker vertices being the bookends (see Lemma 14). If so, adding qx consists in inserting a new chord whose extremities become the new bookends of P(u). Otherwise, we can conclude that G+x is not a circle graph.

  2. 2.

    T contains a tree-edge e whose extremities are both perfect, and this edge is unique; or T contains a tree-edge with one perfect and one empty extremity, and this edge is unique.

    In this case the tree-edge e is unique and 𝐒𝐓(G) is obtained by: i) subdividing e with a new node ux; ii) adding a leaf x adjacent to ux; and iii) labelling ux by a clique of size 3 (if both extremities of e are perfect) or a star on two leaves whose center is opposite to the extremity of e that is empty. Observe that since the new node ux is degenerate, by Theorem 8, G+x is a circle graph.

  3. 3.

    T contains a hybrid node u, and this node is degenerate.

    In this case the node u is unique and 𝐒𝐓(G) is obtained as follows. First perform a node-split on u according to the split (P(u),E(u)), creating a new tree-edge e, whose extremities are both perfect or one is perfect and the other is empty. Then e can be processed as in the previous case. Again, since the modified nodes and the new node are degenerate, by Theorem 8, G+x is a circle graph.

  4. 4.

    T contains a (unique) fully mixed subtree M.

    In this case, the fully mixed subtree is first cleaned and then contracted into a single node v by performing node-joins. When finally adding x, the graph G(v) becomes a prime graph. Along the series of the node-joins, we need to compute chord diagrams that preserve the consecutive property of NG(x) (see Lemma 10). More precisely, the split-tree 𝐒𝐓(G) is obtained in three steps as follows:

    1. (i)

      First, we clean the fully mixed subtree by performing on each degenerate node u of M a node-split with respect to the splits (P(u),V(u)P(u)) and/or (E(u),V(u)E(u)).

      The resulting GLT is denoted 𝖼𝗅(𝐒𝐓(G)). Observe that the set of mixed tree-edges is left unchanged and thereby M can still be abusively considered as the fully mixed subtree of 𝖼𝗅(𝐒𝐓(G)). The difference with 𝐒𝐓(G) is now that every degenerate node of M contains at most one perfect and at most one empty marker (see Figure 7). Moreover by Lemma 14, if G+x is a circle graph, every node u of M has at most two mixed marker vertices which form the bookends of the factor certifying the consecutiveness of MP(u). It follows that the degenerate nodes of 𝖼𝗅(𝐒𝐓(G)) have bounded degree and each of them can be equipped with the accurate CSC in constant time. Otherwise, we can conclude that G+x is not a circle graph.

      Figure 7: A circle graph G=G+10 with vertex 10 being a good vertex of G adjacent to {3,5,7,9}, a chord diagram of G and the cleaned split PC-tree 𝖼𝗅(𝐏𝐂(G)) marked with respect to {3,5,7,9}.
    2. (ii)

      Then, we contract M into a single node v by performing for every mixed tree-edge e=uu in M a node-join on u and u.

      As discussed above, each node-join has to return a chord diagram that preserves the consecutive property of NG(x). Testing if such a chord diagram exists and computing it, can be done efficiently using the CSC data-structure (see Lemma 10). If there is no such chord diagram, then the algorithm stops and concludes that the graph G+x is not a circle graph.

    3. (iii)

      Finally, in the contracted GLT, we attach a leaf x adjacent to node v; and we add to G(v) a new marker qx adjacent to the marker vertices of P(u) and opposite to x.

      In this last step, adding qx consists in inserting a new chord in the chord diagram of G(v), which is possible since it satisfies the consecutive property of NG(x) (see Lemma 11).

5.2 Recognition algorithm

Given that 𝐒𝐓(G) (or 𝐏𝐂(G)) has been correctly marked with respect to NG(x), where G=G+x, the correctness of the updating algorithm described in Subsection 5.1 is proved by Gioan et al. [19] and has been discussed along its description. However, its complexity analysis relies on the split PC-tree data-structure. To achieve an overall linear running time, we implement the updating algorithm in such a way that each vertex x is processed in amortized O(|NG(x)|) time. Compared to the works of Gioan et al. [20, 19], the main challenge is that, given a marker vertex q that belongs to a prime node u, our split PC-tree data structure does not allow to efficiently determine the parent of u. Using the fact that such nodes are prime, we have a chord diagram for them, and x is inserted according to a LexBFS order allows us to anyway determine the parent without sacrificing the running time at least in all cases where this information is needed. Using the information acquired in the first step, the second step can be implemented in much the same way as in the work of Gioan et al. [19]. The major difference is that, in contrast to the data structure they use, ours allows to implement the contraction of fully mixed edges in Case 4 in constant time as there is no need to propagate the parent pointer information. Let us recall that, given a graph G=G+x such that x is a good vertex and G is a circle graph, and given the split PC-tree 𝐏𝐂(G) encoding ST(G)=(T,), the insertion algorithm works in two steps:

  1. 1.

    compute T(NG(x)), the minimal subtree of T covering NG(x);

  2. 2.

    identify the cases according to the description of Subsection 5.1 and update the split-tree correspondingly.

We start discussing the implementation of the first step. For the sake of complexity efficiency, as stated by Lemma 15, if G is a circle graph, we guarantee to compute T(NG(x)) in the expected time complexity. Otherwise, the algorithm may be able to conclude, already at that step, that G=G+x is not a circle graph. The reader has to keep in mind that if 𝐏𝐂(G) encodes the split-tree 𝐒𝐓(G)=(T,), the tree T is not explicitly stored in 𝐏𝐂(G) since we are lacking node objects to represent the prime nodes of 𝐒𝐓(G). However the tree-edges of T are present in 𝐏𝐂(G). The algorithm identifies these tree-edges.

Lemma 15.

Let G=G+x be a graph such that x is a good vertex of G and G is a circle graph. Let 𝐏𝐂(G) be the split PC-tree of G encoding the split-tree 𝐒𝐓(G)=(T,). In time O(|T(NG(x))|), we can either compute T(NG(x)) or conclude that G is not a circle graph.

Proof.

We first describe the algorithm and then analyze its complexity. We let (G) denote the leaves of 𝐏𝐂(G), 𝒟(G) the set of node objects representing the degenerate nodes of 𝐒𝐓(G) in 𝐏𝐂(G), and 𝒞(G) the set of chord endpoints that are involved in the chord diagrams representing the prime nodes of 𝐒𝐓(G). We set (G)=(G)𝒟(G)𝒞(G). To identify the tree-edges of T(NG(x)), we search 𝐏𝐂(G) through the set (G). The algorithm is the following:

  1. 1.

    Initially every leaf in NG(x) is marked as active. Every element of (G)NG(x) is considered as inactive. The set of active elements of (G) is managed in a queue 𝖠𝖼𝗍𝗂𝗏𝖾(G). In parallel, we maintain a set of visited elements of (G), denoted 𝖵𝗂𝗌𝗂𝗍𝖾𝖽(G). Recall that the root r of 𝐏𝐂(G) is a leaf.

  2. 2.

    We perform a first bottom-up traversal of 𝐏𝐂(G) from the leaves in 𝖠𝖼𝗍𝗂𝗏𝖾(G). The objective of this step is to identify a set 𝔈 of tree-edges containing those of T(NG(x)). As long as either r𝖵𝗂𝗌𝗂𝗍𝖾𝖽(G) and |𝖠𝖼𝗍𝗂𝗏𝖾(G)|2, or r𝖵𝗂𝗌𝗂𝗍𝖾𝖽(G) and 𝖠𝖼𝗍𝗂𝗏𝖾(G), we pick the head element a𝖠𝖼𝗍𝗂𝗏𝖾(G), remove it from 𝖠𝖼𝗍𝗂𝗏𝖾(G) and add it to 𝖵𝗂𝗌𝗂𝗍𝖾𝖽(G). If ar, there are three cases to consider:

    • a(G): Let q be the opposite of a. The tree-edge whose extremities are a and q is added to 𝔈. Observe that q is either a marker vertex of a degenerate node or q is the extremity of a chord of the chord diagram representing a prime node). In the former case, if u𝖠𝖼𝗍𝗂𝗏𝖾(G)𝖵𝗂𝗌𝗂𝗍𝖾𝖽(G), then add u to 𝖠𝖼𝗍𝗂𝗏𝖾(G). In the case that q𝐂(G), if q𝖠𝖼𝗍𝗂𝗏𝖾(G)𝖵𝗂𝗌𝗂𝗍𝖾𝖽(G), then we add q to 𝖠𝖼𝗍𝗂𝗏𝖾(G).

    • a𝒟(G): Let p be the root marker vertex of the degenerate node a and q be the opposite of p. We proceed with q as in the previous case.

    • a𝒞(G): Let {a,a} be the corresponding chord. Let u denote the node of 𝐒𝐓(G) containing that chord and 𝐂(u) be the corresponding CSC stored in 𝐏𝐂(G). For each chord endpoint b that is consecutive to a or a in 𝐂(u), we check if b is the flagged root of 𝐂(u). If so, let q be b’s opposite. We proceed with q as in the previous cases. Moreover we add to 𝔈 a so-called fake tree-edge whose extremities are a and b to later retrieve this flagged root information.

  3. 3.

    We perform a second bottom-up traversal of 𝐏𝐂(G) from the leaves in NG(x). The objective is to link the identified tree-edges of 𝔈. Observe that during the previous search, when visiting an endpoint of a chord in a CSC 𝐂(u), the flagged root b of 𝐂(u) may or may not have been identified. Suppose it was when visiting the endpoint a. Then a fake tree-edge between a and b was added to 𝔈. We now search from a the set of consecutive endpoints that were visited during the previous search. For each of them, we add to 𝔈 a new fake tree-edge to a.

    At this point, we have computed a forest whose edges are 𝔈. Observe that in this implementation, if the root endpoint b of a CSC 𝐂(u) is identified, then node u of 𝐒𝐓(G) is represented by a star whose root is b and possibly a set of isolated endpoints.

  4. 4.

    The last step consists in checking whether 𝔈 allows to retrieve T(NG(x)). We first check whether the resulting set 𝔈 of (fake) tree-edges form a connected tree. If not, we return that G is not a circle graph. Otherwise, let T(𝔈) denote that tree. We may have to clear the path attached to the root s of T(𝔈). Suppose that s is distinct from the root of 𝐏𝐂(G) or it is the root r of 𝐏𝐂(G) (which is a leaf of 𝐏𝐂(G)) but the corresponding vertex does not belong to NG(x). Then remove from T(𝔈), the tree-edges of the path from that root to its first descendant with at least two children. This step can be completed by an extra search.

Since the described algorithm basically consists in three traversals, its complexity is O(|𝔈|). The key point concerning the running time is that the round-robin execution of the upward searches in step 2 guarantees that |𝔈|2|T(NG(x))|.

Concerning the correctness, the important point is that, if G is a circle graph and the marker corresponding to the parent of a prime node u is in MP(u), then by Lemma 14, one of its consecutive chords (in CSC(u)) is also in MP(u), and thus the parent chord will be identified at some point during the traversal. Thus, if G is a circle graph the algorithm correctly computes the tree-edges of T(NG(x)).

We now have to mark the tree-edge extremities of 𝐏𝐂(G), each of which is either a marker vertex of a degenerate node or an endpoint of a chord in a CSC. Given that T(NG(x)) has been identified, the marking procedure that is fully described in [20] (Lemma 5.10 therein) runs in O(|T(NG(x))|) time. Within the same time complexity, we can identify which of the cases described in Subsection 5.1 holds. At that step, the node-split operation on degenerate nodes is required. Let us remark that, as in a split PC-tree every degenerate node maintains a pointer to its parent node, we can perform the node-split as described in [20].

Lemma 16 ([20]).

Let u be a degenerate node of the split PC-tree 𝐏𝐂(G) of a circle graph. If (A,B) is a split of G(u), then node-splitting u according to (A,B) can be done in O(|A|)-time.

Let us now describe how, having computed T(NG(x)) and marked 𝐏𝐂(G) according to NG(x), we can efficiently compute 𝐏𝐂(G+x).

Lemma 17.

Let G=G+x be a graph such that x is a good vertex of G and G is a circle graph. Assume that 𝐏𝐂(G) and T(NG(x)) are given and that every edge extremity is marked according to NG(x). In time O(|T(NG(x))|), we can either compute 𝐏𝐂(G) or conclude that G is not a circle graph.

Proof.

Let us consider the four distinct cases identified in Subsection 5.1.

  1. 1.

    T contains a clique node u whose marker vertices are all perfect; or T contains a star node u whose marker vertices are all empty except its center, which is perfect; or T contains a unique hybrid node u, which is prime.

    Suppose that u is prime, since otherwise 𝐏𝐂(G) is obtained by adding a leaf to a degenerate node which can be done in O(1)-time. We need to test if the chord endpoints of MP(u) are consecutive in the CSC 𝐂(u). This can be done in O(|MP(u)|)-time by Lemma 9. If the test fails, we can conclude that G+x is not a circle graph. Otherwise we insert the new chord corresponding to x, which by Lemma 11 can be done in O(1)-time. Observe that if a marker vertex (or a chord endpoint) is perfect or mixed, then its incident tree-edge belongs to T(NG(x)). So we have |MP(u)||T(NG(x))| implying that the global complexity is O(|T(NG(x))|).

  2. 2.

    T contains a tree-edge e whose extremities are both perfect, and this edge is unique; or T contains a tree-edge with one perfect and one empty extremity, and this edge is unique.

    In this case, 𝐏𝐂(G) is obtained by subdividing e by a new ternary degenerate node. This can clearly be achieved in O(1)-time.

  3. 3.

    T contains a hybrid node u, and this node is degenerate.

    In this case, 𝐏𝐂(G) is obtained by first performing a node-split of u according to (P(u),E(u)) and then inserting a new degenerate node. By Lemma 16 and the discussion above, this can be done in O(|P(u)|)-time. Since every perfect marker vertex of u is incident to a tree-edge of T(NG(x)), the statement holds.

  4. 4.

    T contains a (unique) fully mixed subtree M.

    We first have to perform the cleaning step. By Lemma 16, this can be done in global O(|T(NG(x))|) time. Then we construct a CSC for each mixed degenerate node, which takes global O(|T(NG(x))|) time, since each of them has constant size. Finally, by Lemma 10, the contraction of the fully mixed subtree of 𝖼𝗅(𝐏𝐂(G)) can also be performed in O(|T(NG(x))|)-time. Observe that the contraction step may fail if some node join cannot return a chord diagram satisfying the consecutive property. Finally, by Lemma 11, inserting a new chord to the CSC resulting from the series of contraction can be achieved in O(1)-time.

5.3 Amortized time complexity analysis

A key ingredient in the complexity analysis is the following result, which bounds the size of T(NG(x)) in terms of the size of NG(x).

Lemma 18 ([30, 33]).

Let 𝐒𝐓(G)=(T,) be the split-tree of a graph G. For every vertex x of G, |T(NG(x))|2|NG(x)|.

Given the split PC-tree 𝐏𝐂(G) of a circle graph G, testing if G=G+x is a circle graph amounts to computing 𝐏𝐂(G). For this we have access to T(NG(x)), with 𝐒𝐓(G)=(T,), and not to T(NG(x)), with 𝐒𝐓(G)=(T,). Observe that Lemma 17 establishes an insertion complexity in time linear in the size of T(NG(x)). This is not sufficient to establish an overall linear running time. Indeed, the size of T(NG(x)) can be significantly larger than |NG(x)|. In that case, Lemma 18 says that |T(NG(x))| is significantly smaller than |T(NG(x))|. This is the case when a large fully-mixed subtree is contracted into a single prime node. So to circumvent this issue, we show that inserting a good vertex x in a circle graph G takes amortized time O(|NG(x)|) if G=G+x is a circle graph. We use the method of potentials introduced in [32]; see [5, Ch. 17.3] for a modern exposition.

We define a potential function Φ on GLT’s representing a split decomposition. Let (T,) be a GLT. For an inner node u of T, we define:

Φu={1 if u is non-degenerate,degT(u)2 if u is degenerate.

And we set Φ(T,)=uTΦu. Note that, by definition, the potential is non-negative. The amortized cost to insert vertex x is

a(x)=t(x)+Φ(𝐒𝐓(G+x))Φ(𝐒𝐓(G)),

where t(x) is the actual cost, which is given by Lemma 17, that is O(|T(NG(x))|).

The intuition behind the definition of this potential function is the following. When a large fully-mixed subtree into contracted into a single node, which is a costly operation, then the potential will significantly decrease. By contrast, when a new degenerate node or new leaf adjacent to a degenerate node is added, which can be done efficiently, then the potential increases, but only slightly. This implies the overall amortized linear running time.

Lemma 19.

Let G=G+x be a graph such that x is a good vertex of G and G is a circle graph. If G is a circle graph, then 𝐏𝐂(G) can be computed from 𝐏𝐂(G) in amortized O(|NG(x)|) time.

Proof.

Let us denote 𝐒𝐓(G)=(T,) and 𝐒𝐓(G)=(T,). By Lemma 17, the actual cost t(x) is in O(|T(NG(x))|). We now consider the four cases identified in Subsection 5.1 and in each of them determine the potential difference and the resulting amortized running time.

  1. 1.

    As 𝐒𝐓(G) is obtained from 𝐒𝐓(G) by either adding a chord to a prime node or by adding a new leaf, we have Φ(𝐒𝐓(G))Φ(𝐒𝐓(G))1. Moreover, we have |T(NG(x))|=|T(NG(x))|. So by Lemma 18, |T(NG(x))|2|NG(x)|. Thus, t(x) is in O(|NG(x)|) and Φ(𝐒𝐓(G+x))Φ(𝐒𝐓(G)) is constant, which yields an amortized running time a(x) in O(|NG(x)|).

  2. 2.

    In this case 𝐒𝐓(G) is obtained from 𝐒𝐓(G) by subdividing an edge with a new degenerate node of degree 3. Thus we have Φ(𝐒𝐓(G))Φ(𝐒𝐓(G))=1 and |T(NG(x))|=|T(NG(x))|1. So by Lemma 18, |T(NG(x))|=|T(NG(x))|12|NG(x)|1. Thus, t(x) is in O(|NG(x)|) and Φ(𝐒𝐓(G+x))Φ(𝐒𝐓(G)) is constant, which yields an amortized running time a(x) in O(|NG(x)|).

  3. 3.

    In this case 𝐒𝐓(G) is obtained from 𝐒𝐓(G) by splitting a hybrid node u that is degenerate into two adjacent nodes v,w and then using the previous case to handle the edge vw. Observe that performing a node-split on a degenerate node does not change the potential. Moreover as discussed in the previous case, subdividing a tree-edge to insert a degenerate node of degree 3 increases the potential of the resulting GLT by 1. It follows that Φ(𝐒𝐓(G))Φ(𝐒𝐓(G))=1. Observe that |T(NG(x))|=|T(NG(x))|2, then by Lemma 18, |T(NG(x))|=|T(NG(x))|22|NG(x)|2. Thus, t(x) is in O(|NG(x)|) and Φ(𝐒𝐓(G+x))Φ(𝐒𝐓(G)) is constant, which yields an amortized running time a(x) in O(|NG(x)|).

  4. 4.

    Suppose that the fully-mixed subtree of 𝐒𝐓(G) contains d degenerate nodes and p prime nodes. Since each node-split of a degenerate node leaves the potential unchanged, we have Φ(𝖼𝗅(𝐒𝐓(G))=Φ(𝐒𝐓(G)). Observe that in 𝖼𝗅(𝐒𝐓(G)), every degenerate node u has degree 3, implying that Φu=1. Thus every node (degenerate or prime) of the fully mixed subtree of 𝖼𝗅(𝐒𝐓(G)) contributes 1 to Φ(𝖼𝗅(𝐒𝐓(G))). Since 𝐒𝐓(G) is obtained by contracting the fully-mixed subtree of 𝖼𝗅(𝐒𝐓(G)) to a single prime node, it follows that Φ(𝐒𝐓(G))=Φ(𝖼𝗅(𝐒𝐓(G)))dp+1. So we have Φ(𝐒𝐓(G))Φ(𝐒𝐓(G))=dp+1. Let us now analyze the size of T(NG(x)) compared to T(NG(x)). Observe that a degenerate node may be split twice, but then in the contraction step, one of the up to three resulting nodes disappears in T(NG(x)). Moreover every prime node of T(NG(x)) also disappears during the contraction step. It follows that |T(NG(x))||T(NG(x))|+d+p1. Then, by Lemma 18, |T(NG(x))|2|NG(x)|+d+p1. It follows that the amortized running time is a(x)=|T(NG(x))|+Φ(𝐒𝐓(G))Φ(𝐒𝐓(G))2|NG(x)|.

Theorem 20.

Let G be a graph on n vertices and m edges. Deciding if G is a circle graph can be done in O(n+m).

Proof.

Since the correctness of the algorithm is proved in Gioan et al. [19], we only discuss the complexity analysis. If G is a circle graph, then by Lemma 19, the algorithm builds the split PC-tree 𝐏𝐂(G) in amortized linear time. So suppose that G is not a circle graph. Let σ be the LexBFS ordering in which the vertices are processed by the algorithm and x be the earliest vertex in σ and S be the subset of vertices containing all vertices y such that y<σx. Then G[S] is a circle graph and we note 𝐒𝐓(G[S])=(TS,S). The fact that G[S]+x is not a circle graph is detected either during the computation of TS(N(x)) or when we try to insert the chord corresponding to x to a chord diagram representing a prime node in the split PC-tree in hand. By Lemma 15 and by Lemma 17, this can be decided in time O(|TS(N(x))|) which is compatible with the amortized complexity analysis of Lemma 19.

References

  • [1] A. Bouchet. Caractérisation des symboles croisés de genre nul. Compte-rendus Académie des Sciences (CRAS), 274:724–727, 1972.
  • [2] A. Bouchet. Reducing prime graphs and recognizing circle graphs. Combinatorica, 7:243–254, 1987. doi:10.1007/BF02579301.
  • [3] A. Bouchet. Circle graph obstructions. Journal of Combinatorial Theory Series B, 60:107–144, 1994. doi:10.1006/jctb.1994.1008.
  • [4] G. Brückner, I. Rutter, and P. Stumpf. Extending partial representation of circle graphs in near-linear time. Algorithmica, 86(7):2152–2173, 2024. doi:10.1007/s00453-024-01216-5.
  • [5] T.H. Cormen, C.E. Leiserson, R.L. Rivest, and C. Stein. Introduction to Algorithms. The MIT Press, 3rd edition, 2001.
  • [6] D.G. Corneil, S. Olariu, and L. Stewart. The LBFS structure and recognition of interval graphs. SIAM Journal on Computing, 23(4):1905–1953, 2009. doi:10.1137/S0895480100373455.
  • [7] B. Courcelle. Circle graphs and monadic second-order logic. Journal of Applied Logic, 6:416–442, 2008. doi:10.1016/j.jal.2007.05.001.
  • [8] W.H. Cunningham and J. Edmonds. A combinatorial decomposition theory. Canadian Journal of Mathematics, 32(3):734–765, 1980. doi:10.4153/CJM-1980-057-7.
  • [9] E. Dahlhaus. Efficient parallel and linear time sequential split decomposition (extended abstract). In Foundations of Software Technology and Theoretical Computer Science - FSTTCS, volume 880 of Lecture Notes in Computer Science, pages 171–180, 1994. doi:10.1007/3-540-58715-2_123.
  • [10] E. Dahlhaus. Parallel algorithms for hierarchical clustering and applications to split decomposition and parity graph recognition. Journal of Algorithms, 36(2):205–240, 2000. doi:10.1006/jagm.2000.1090.
  • [11] H. de Fraysseix. A characterization of circle graphs. European Journal of Combinatorics, 5:223–238, 1984. doi:10.1016/S0195-6698(84)80005-0.
  • [12] S. Even and A. Itai. Queues, stacks and graphs. Theory of Machines and Computations, pages 71–86, 1971. doi:10.1016/B978-0-12-417750-5.50011-7.
  • [13] S.D. Fink, M. Pfrestzschner, and I. Rutter. Experimental comparison of PC-trees and PQ-trees. ACM Journal of Experimental Algorithms, 28:24, 2023. doi:10.1145/3611653.
  • [14] J.C. Fournier. Une caractérisation des graphes de cordes. Compte-rendus Académie des Sciences (CRAS), 286A:811–813, 1978.
  • [15] C.P. Gabor, W.L. Hsu, and K.J. Suppovit. Recognizing circle graphs in polynomial time. Journal of ACM, 36:435–473, 1989. doi:10.1145/65950.65951.
  • [16] B.A. Galler and M.J. Fischer. An improved equivalence algorithm. Communications of the ACM, 7(5):301–303, 1964. doi:10.1145/364099.364331.
  • [17] J. Geelen, O j. Kwon, R. McCarty, and P. Wollan. The grid theorem for vertex-minors. Journal of Combinatorial Theory, Series B, 158:93–116, 2023. doi:10.1016/j.jctb.2020.08.004.
  • [18] E. Gioan and C. Paul. Split decomposition and graph-labelled trees: characterizations and fully dynamic algorithms for totally decomposable graphs. Discrete Applied Mathematics, 160:708–723, 2012. doi:10.1016/j.dam.2011.05.007.
  • [19] E. Gioan, C. Paul, M. Tedder, and D.G Corneil. Practical and efficient circle graph recognition. Algorithmica, 69:759–788, 2014. doi:10.1007/s00453-013-9745-8.
  • [20] E. Gioan, C. Paul, M. Tedder, and D.G Corneil. Practical and efficient split decomposition via graph-labelled trees. Algorithmica, 69:789–843, 2014. doi:10.1007/s00453-013-9752-9.
  • [21] W.-L. Hsu and R. McConnell. PC trees and cicular-ones arrangements. Theoretical Computer Science, 296:99–116, 2003. doi:10.1016/S0304-3975(02)00435-8.
  • [22] W.L. Hsu. O(mn) algorithms for the recognition and isomorphism problems on circular-arc. SIAM Journal on Computing, 24(3):411–439, 1995. doi:10.1137/S0097539793260726.
  • [23] V. Kalisz, P. Klavík, and P. Zeman. Circle graph isomorphism in almost linear time. In Annual Conference on Theory and Applications of Models of Computation - TAMC, volume 13571 of Lecture Notes in Computer Science, pages 176–188, 2022. doi:10.1007/978-3-031-20350-3_15.
  • [24] A. Kotzig. Quelques remarques sur les transformations K. In Séminaire de Paris, 1977.
  • [25] T.-H. Ma and J. Spinrad. An O(n2) algorithm for undirected split decomposition. Journal of Algorithms, 16:145–160, 1994. doi:10.1006/jagm.1994.1007.
  • [26] W. Naji. Reconnaissance des graphes de cordes. Discrete Mathematics, 54:329–337, 1985. doi:10.1016/0012-365X(85)90117-7.
  • [27] S.I. Oum. Rank-width and vertex-minors. Journal of Combinatorial Theory Series B, 95:79–100, 2005. doi:10.1016/j.jctb.2005.03.003.
  • [28] N. Robertson and P. Seymour. Graph minors V: excluding a planar graph. Journal of Combinatorial Theory Series B, 41:92–114, 1986. doi:10.1016/0095-8956(86)90030-4.
  • [29] N. Robertson and P. Seymour. Graph minors IV. tree-width and well-quasi-ordering. Journal of Combinatorial Theory Series B, 48:227–254, 1990. doi:10.1016/0095-8956(90)90120-O.
  • [30] D.J. Rose, R.E. Tarjan, and G.S. Lueker. Algorithmic aspects of vertex elimination on graphs. SIAM Journal on Computing, 5(2):266–283, 1976. doi:10.1137/0205021.
  • [31] W. K. Shih and W. L. Hsu. A new planarity test. Theoretical Computer Science, 223:179–191, 1999. doi:10.1016/S0304-3975(98)00120-0.
  • [32] D.D. Sleator and R.E. Tarjan. Amortized efficiency of list update and paging rules. Communication of the ACM, 28(2):202–208, 1985. doi:10.1145/2786.2793.
  • [33] J. Spinrad. Recognition of circle graphs. Journal of Algorithms, 16:264–282, 1994. doi:10.1006/jagm.1994.1012.
  • [34] R. Tarjan. Efficiency of a good but not linear set union algorithm. Journal of the ACM, 22:215–225, 1975. doi:10.1145/321879.321884.