# Recognition of Unipolar and Generalised Split Graphs

^{1}

^{2}

^{*}

## Abstract

**:**

^{2})-time algorithm for recognition of n-vertex generalised split graphs, improving on previous O(n

^{3})-time algorithms.

## 1. Introduction

#### 1.1. Definition and Motivation

^{k}

_{i=0}so that there are no edges between C

_{i}and C

_{j}for 1 ≤ i < j ≤ k. A graph G is a generalised split graph if either G or its complement G is unipolar. All generalised split graphs are perfect; and Prömel and Steger [1] show that almost all perfect graphs are generalised split graphs. Perfect graphs can be recognised in polynomial time [2,3], and there are many NP-hard problems which are solvable in polynomial time for perfect graphs, including the stable set problem, the clique problem, the colouring problem, the clique covering problem and their weighted versions [4]. If the input graph is restricted to be a generalised split graph, then there are much more efficient algorithms for the problems above [5]. In this paper we address the problem of efficiently recognising generalised split graphs, and finding a witnessing partition.

^{3}) running time, [7] with O(n

^{2}m) time and [5] with O(nm+nm′) time, where n and m are respectively the number of vertices and edges of the input graph, and m′ is the number of edges added after a triangulation of the input graph. Note that almost all unipolar graphs and almost all generalised split graphs have (1 + o(1))n

^{2}/4 edges (see our paper “Random perfect graphs”, which is under preparation). Further, by testing whether G or $\overline{G}$ is unipolar, each of the mentioned algorithms above recognises generalised split graphs in O(n

^{3}) time. The algorithm in this paper has running time O(n

^{2}).

^{2.5}) expected running time for a random perfect graph R

_{n}and an exponentially small probability of exceeding this time bound. Here we assume that R

_{n}is sampled uniformly from the perfect graphs on vertex set [n] = {1, 2, … n}.

#### 1.2. Notation

^{+}(v) denote N(v) ∪ {v}, also called the closed neighbourhood of v. If G = (V, E) and S ⊆ V, then G[S] denotes the subgraph induced by S. Let $\mathcal{G}{\mathcal{S}}^{+}$ be the set of all unipolar graphs and let $\mathcal{G}\mathcal{S}$ be the set of all generalised split graphs. Fix $G=(V,E)\notin \mathcal{G}{\mathcal{S}}^{+}$. If V

_{0}, V

_{1}⊆ V with V

_{0}∩ V

_{1}= ∅ and V

_{0}∪ V

_{1}= V are such that V

_{0}is a clique and V

_{1}is a disjoint union of cliques, then the ordered pair (V

_{0}, V

_{1}) will be called a unipolar representation of G or just a representation of G. For each unipolar representation R = (V

_{0}, V

_{1}) we call V

_{0}the central clique of R, and we call the maximal cliques of V

_{1}the side cliques of R. A graph is unipolar iff it has a unipolar representation.

**Definition 1.1.**Let R = (V

_{0}, V

_{1}) be a unipolar representation of a graph G. A partition$\mathcal{B}$ of V (G) is a block decomposition of G with respect to R if the intersection of each part of B with V

_{1}is either a side clique or ∅.

#### 1.3. Plan of the Paper

#### 1.4. Data Structures

## 2. Verification of Block Decomposition

#### 2.1. 2-SAT

_{1}, …, x

_{n}be n boolean variables. A 2-clause is an expression of the form y

_{1}∨ y

_{2}, where each y

_{j}is a variable, x

_{i}, or the negation of a variable, ¬x

_{i}. There are 4n

^{2}possible 2-clauses. The problem of deciding whether or not a formula of the form ψ = ∃x

_{1}∃x

_{2}… ∃x

_{n}(c

_{1}∧ c

_{2}∧ … ∧ c

_{m}), where each c

_{j}is a 2-clause, is satisfiable is called 2-SAT. The problem 2-SAT is solvable in O(n + m) time – [8,9], where n is the number of variables and m is the number of clauses in the input formula.

#### 2.2. Transformation to 2-SAT

_{0}of a representation, with the remaining vertices in the blocks forming the side cliques. Suppose that $\left|\mathcal{B}\right|$ = m, and $\mathcal{B}$ is represented by a surjective function f : V → [m], so that $\mathcal{B}$ = {f

^{−1}[i] : i ∈ [m. Let {x

_{v}: v ∈ V } be Boolean variables. We use Algorithm 1 to construct a formula ψ (x

_{1}, … x

_{n}), so that each satisfying assignment of {x

_{v}} corresponds to a representation of G.

**Lemma 2.1.**The formula ψ is satisfiable iff$\mathcal{B}$ is a block decomposition for some representation. Indeed an assignment Φ : {x

_{v}: v ∈ V} → {0, 1} satisfies ψ if and only if R = (V

_{0}, V

_{1}) is a representation of G and$\mathcal{B}$ is a block decomposition of G with respect to R, where V

_{i}= {v ∈ V : Φ(v) = 1 − i}.

**Proof.**Suppose Φ is a satisfying assignment and let V

_{0}, V

_{1}be as above. If u and v are both in V

_{0}, then uv ∈ E, since otherwise Φ contains a clause ¬x

_{u}∨ ¬x

_{v}. If u and v are in V

_{1}, then either uv ∈ E and f(u) = f(v) or uv ∉ E and f(u) ≠ f(v), because in the other two cases ϕ contains the clause x

_{u}∨ x

_{v}. This means that the vertices in V

_{1}are grouped into cliques by their value of f. For the other direction, it is sufficient to verify that each generated clause is satisfied, which is a routine check. □

^{2}) time is spent preparing ψ. The formula ψ can have at most 2 clauses per pair {u, v}, so the length of ψ is also O(n

^{2}), and since 2-SAT can be solved in linear time, the total time for this step is O(n

^{2}).

## 3. Independent Set

#### 3.1. Maximum Independent Set of a Unipolar Graph

_{1}and R

_{2}of G we have |s(R

_{1}, G) − s(R

_{2}, G)| ≤ 1.

_{n}or its complement, then the number s(R, G) depends on R. However, this is not necessarily the case for all graphs, see Figure 1. It can be shown that the number of n-vertex unipolar graphs with a unique representation is, $\left(1-\phantom{\rule{0.2em}{0ex}}{e}^{-}{}^{\mathrm{\Theta}(n)}\right)\left|\mathcal{G}{\mathcal{S}}^{+}{}_{n}\right|$ and that the number of n-vertex unipolar graphs G with a unique representation R and such that $s\left(G,\phantom{\rule{0.2em}{0ex}}R\right)=\alpha \left(G\right)\text{is}\left(1-\phantom{\rule{0.2em}{0ex}}{e}^{-}{}^{\Omega (n\delta )}\right)\left|\mathcal{G}{\mathcal{S}}^{+}{}_{n}\right|$ for a constant δ > 0 (see our paper “Random perfect graphs”, which is under preparation).

#### 3.2. Independent Set Algorithm

_{R}s(R, G), where the maximum is over all representations R of G. For $G\notin \mathcal{G}{\mathcal{S}}^{+}$ set s(G) = 0. In this section we see how to find a maximal independent set I, such that if $G\in \mathcal{G}{\mathcal{S}}^{+}$, then |I| ≥ s(G) (≥ α(G) − 1).

_{1}and v

_{2}, pick r = 1 or 2 of these vertices to add to I, and delete from G the closed neighbourhood of the added vertices. We do this in such a way that a given representation R of G yields a representation with r less side cliques, or (only when r = 2) with one less side clique and the central clique removed.

#### 3.3. Correctness

**Lemma 3.1.**Algorithm 2 always returns a maximal independent set I.

**Proof.**This is easy to see, since each vertex deleted from U is adjacent to a vertex put in I.

**Lemma 3.2.**If Algorithm 2 returns I, then |I| ≥ s(G).

**Proof.**If $G\notin \mathcal{G}{\mathcal{S}}^{+}$, then the statement holds, because s(G) = 0. From now on assume that $G\in \mathcal{G}{\mathcal{S}}^{+}.$

^{0}| + r ≥ s(R

^{0}, G

^{0}) + r = s(R, G).

^{+}(u) contains the side clique of u and perhaps parts of the central clique. Therefore, N

^{+}(u) \ N

^{+}(v) is a subset of the side clique of u, and hence it is a clique. If N

^{+}(v) \ N

^{+}(u) is a not clique, then the algorithm continues recursively with G[V \ N

^{+}(u)]; and using the same arguments as above with r = 1, we guarantee correct behaviour. Now assume that N

^{+}(v) \ N

^{+}(u) is a clique. Then N

^{+}(v) \ N

^{+}(u) can intersect at most one side clique, because the vertices in different side cliques are not adjacent. In this case N

^{+}(v) ∪ N

^{+}(u) completely covers the side clique of u, completely covers the central clique, and it may intersect one additional side clique. Hence s(R, G) = s(R′, G′) + 1 or s(R, G) = s(R′, G′) + 2, where G′ and R′ are the induced graph and representation after the removal of N

^{+}(v) ∪ N

^{+}(u). If I′ is the recursively obtained independent set, from the induction hypothesis we deduce that |I| = |I|′ + 2 ≥ s(R′, G′) + 2 ≥ s(R, G).

#### 3.4. Time Complexity

^{2}) time, because checking whether an induced subgraph is complete is slow. However, we can maintain a set of vertices, C, which we have seen to induce a complete graph. We will create an efficient procedure to check if a subgraph is complete, and to return some additional information to be used for future calls if the subgraph is not complete.

**Lemma 3.3.**Let C ⊆ U and suppose that G[C] is complete. If G[U] is complete, then antiedge(G, U, C) returns (F alse, U); if not, then it returns (uv, C

^{0}) such that

- $uv\in C\prime \times (U\backslash \phantom{\rule{0.2em}{0ex}}C\prime )-E\left(G\right)i.e.\phantom{\rule{0.2em}{0ex}}u\in C\prime ,v\in U\backslash C\prime ,\phantom{\rule{0.2em}{0ex}}uv\notin E\left(G\right)$
- $C\subseteq C\prime \subseteq U$
- $G[C\prime ]$ is complete

**Proof.**Easy checking. □

**Lemma 3.4.**Let U and C be the sets stored in the respective variables at the beginning of an iteration of the main loop of Algorithm 4, and let U′ and C′ be the sets stored at the beginning of the next iteration, if the algorithm does not terminate meanwhile. The following loop invariants hold:

- G[C] is complete and C ⊆ U
- U′ \ C′ ⊆ U \ C.

**Proof.**Observe that the initial values of U and C, which are V and Ø respectively, guarantee by Lemma 3.3 that the values after the call to Algorithm 3 satisfy condition (1). Therefore, (1) holds for the first iteration. Concerning future iterations, observe that (1) guarantees the precondition of Lemma 3.3, which it turn guarantees (1) for the next iteration. We deduce that (1) does indeed give a loop invariant. By proving this we have proved that the preconditions of Lemma 3.3 are always met; and so we can use Lemma 3.3 throughout.

_{1}u

_{2}. Depending on e

_{1}and e

_{2}there are two cases for how many vertices are excluded.

_{1}is excluded, so U′ = U \N

^{+}(u

_{1}), C∩U

_{2}⊆ C

^{0}and C ⊆ N

^{+}(u) ∪ N

^{+}(u2). Then

**Corollary 3.5.**A vertex can be absorbed once at most.

**Proof.**Let U, C, U′ and C′ be as before. Observe that if, during the iteration, vertex v is absorbed in a call to Algorithm 3, then v ∈ U \ C and v ∉ U′ \ C′. The Corollary now follows from the second invariant in Lemma 3.4. □

**Lemma 3.6.**Algorithm 4 takes O(n

^{2}) time.

**Proof.**The total running time of each iteration of the main loop of Algorithm 4 besides calling Algorithm 3 is O(n). The set U decreases by at least one vertex on each iteration, so the time spent outside of Algorithm 3 is O(n

^{2}).

^{2}) time is spent in all calls to Algorithm 3 for absorbing vertices.

_{1}. Since v is not absorbed, we may assume that Algorithm 3 has returned the pair of vertices vu. At least one of u and v is removed (along with its neighbourhood) from U and moved to I. If v is removed from U, then no more time can be spent on it by Algorithm 3, hence the total time spent on v by Algorithm 3 is O(n). Now assume that u is removed. We have that C

_{1}⊆ N

^{+}(u) and each vertex in N

^{+}(u) is removed from U. Hence, if v is processed again by Algorithm 3, it will be tested against a set C

_{2}with C

_{1}∩ C

_{2}= Ø, and therefore |C

_{1}| + |C

_{2}| = |C

_{1}∪ C

_{2}| = O(n). As we saw before, if v is absorbed or removed from U, then it cannot be processed again by Algorithm 3; and thus the running time spent on v is again O(n). If v is not removed from U, then C

_{2}is removed from U. Hence, if v is processed again by Algorithm 3, v will be tested against a set C

_{3}with |C

_{1}| + |C

_{2}| + |C

_{3}| = |C

_{1}∪ C

_{2}∪ C

_{3}| = O(n), and so on. Thus, we see that over all these tests, each vertex is tested at most once for adjacency to v, and so the total time spent on v is O(n).

## 4. Building Blocks and Recognition

#### 4.1. Block Creation Algorithm

**Lemma 4.1.**Suppose that I ⊆ V (G) is an independent set with |I| ≥ s(G) − 1 and V

_{0}∩ I = Ø for some unipolar representation R = (V

_{0}, V

_{1}) of G. Then test(G, I) returns True.

**Proof.**On each step of the main loop a vertex from i ∈ I is selected. Since V

_{0}∩ I = Ø, the vertex i is a part of some side clique, say C. Now C ∩ N

^{+}(j) = Ø for each j ∈ I \ {i}, so C ⊆ U. Also C ⊆ N

^{+}(i), and hence C ⊆ N

^{+}(i) ∩ U. Vertex i does not see vertices from other side cliques, so N

^{+}(i) ∩ U is correctly marked as a separate block.

_{1}= Ø or U ∩ V

_{1}is a side clique; so U is correctly marked as a separate block. The set U also contains all remaining vertices, so f is partition of V into blocks, and hence Algorithm 1 returns True.

#### 4.2. Block Decomposition Algorithm

_{0}| ≤ 1. The running time is O(|I|n

^{2}) = O(n

^{3}), while we aim for O(n

^{2}). However, with relatively little effort we can localize I ∩ V

_{0}to at most 2 candidates from I.

#### 4.3. Correctness

**Lemma 4.2.**Algorithm 7 returns True on input G iff $G\in \mathcal{G}{\mathcal{S}}^{+}$.

**Proof.**First assume that $G\in \mathcal{G}{\mathcal{S}}^{+}$ and let R = (V

_{0}, V

_{1}) be an arbitrary representation of G. Let I = indep(G). By Lemma 3.2, |I| ≥ s(G) ≥ s(R, G). Since V

_{0}is a clique and I is an independent set, we have |V

_{0}∩ I| ≤ 1.

_{0}∩ I = Ø. Observe that Algorithm 6 returns test(G, I′), where I′ is either I or I \ {v} for some v ∈ I, hence |I

^{0}| ≥ |I| − 1 ≥ s(G) − 1; I′ ⊆ I ⊆ V

_{1}, so test(G, I′) = True from Lemma 4.1.

_{0}∩ I = {c}. Algorithm 6 starts by calculating the set C, where C = I if there is no v ∈ V with |N

^{+}(v) ∩ I| = 2, and otherwise

^{+}(v) ∩ I| = 2 for some v ∈ V. If v ∈ V, then c ∈ N

^{+}(v), because V

_{0}is a clique. If v ∈ V

_{1}, then N

^{+}(v) can intersect at most one vertex from I ∩V

_{1}and at most one vertex from I ∩V0 = {c} and since |N+(v)∩I| = 2, we have c ∈ N

^{+}(v). For each v ∈ V if |N

^{+}(v)∩I| = 2, then c ∈ N

^{+}(v)∩I, so c belongs to their intersection. If no v ∈ V exists with |N

^{+}(v) ∩ I| = 2, then C = I, but c ∈ I, so again c ∈ C. We deduce that if V

_{0}∩ I = {c}, then c ∈ C and |C| > 0.

^{+}(v) ∩ I| = 2. Either |I| = s(R, G) or |I| = s(R, G) + 1, so either all side cliques are represented by vertices of I, or at most one is not represented, say S. We can handle both cases simultaneously by saying that S = Ø in the former case. We have that I is a maximal independent set, but no vertex of I \ {c} can see a vertex of S, because they belong to different side cliques, so c is connected to all vertices of S and therefore {c} ∪ S is a clique. Let T = N(c) ∩ (V

_{1}\ S). Then |N

^{+}(v) ∩ I| = 2 for each v ∈ T, but no such vertex exists by assumption, so T = Ø. Now N(c) ∩ V

_{1}= S, and V

_{1}is a union of disjoint cliques, so V

_{1}∪ {c} is also a union of disjoint cliques. Hence R′ = (V

_{0}\ {c}, V

_{1}∪ {c}) is a representation of G, so from Lemma 4.1 test(G, I) = True.

#### 4.4. Time Complexity

**Lemma 4.3.**Algorithm 7 takes O(n

^{2}) time.

**Proof.**Algorithm 5 loops over a subset of V and intersects two subsets of V, so the time for each step is bounded by O(n), and since the number of steps is O(n), O(n

^{2}) time is spent in the loop. Then it performs one more operation in O(n) time, so the total time spent for preparation is O(n

^{2}). Then Algorithm 5 calls Algorithm 1, which takes O(n

^{2}) time, so the total running time of Algorithm 5 is O(n

^{2}).

^{2}) time in the first stage. Depending on the size of C, Algorithm 6 calls Algorithm 5 once or twice, but in both cases it takes O(n

^{2}) time, so the total running time of Algorithm 6 is O(n

^{2}). The total time spent for recognition is the time spent for Algorithm 6 plus the time spent for Algorithm 4, and since both are O(n

^{2}), the total running time for recognition is O(n

^{2}). □

## 5. Algorithms for Random Perfect Graphs

_{0}).

_{1}, … C

_{k}, then

_{0}is the central clique. Therefore, in order to find a maximum clique or a minimum colouring, it is sufficient to solve the corresponding problem in each of the co-bipartite graphs induced by the central clique and a side clique. The vertices outside a clique in a co-bipartite graph form a cover in the complementary bipartite graph, and the vertices coloured with the same colour in a proper colouring of a co-bipartite graph form a matching in the complementary bipartite graph. By König’s theorem it is easy to find a minimum cover using a given maximum matching, and therefore finding a maximum clique and a minimum colouring in a co-bipartite graph is equivalent to finding a maximum matching in the complementary bipartite graph. For colourings, we explicitly find a minimum colouring in each co-bipartite graph G[C

_{0}∪ C

_{i}], and such colourings can be fitted together using no more colours, since C

_{0}is a clique cutset. Assume that $\overline{G\left[{C}_{0}\cup \phantom{\rule{0.2em}{0ex}}{C}_{i}\right]}$ contains n

_{i}vertices and m

_{i}edges, so each n

_{i}≤ n and ${\sum}_{i}{m}_{i}\le \left|{C}_{0}\right|\left(n-\left|{C}_{0}\right|\right)\le n/4.$ We could use the Hopcroft–Karp algorithm for maximum matching in $O((E|+|V|)\sqrt{\left|V\right|})$ time to find time bound ${\sum}_{i}O(({m}_{i}+{n}_{i})\sqrt{{n}_{i}})}=O((n+m)\sqrt{n})=O({n}^{2.5}).$

^{3.5}/log n) time, instead of the claimed O(n

^{2.5}/log n). In order to see the problem consider the case when the input graph is a split graph with an equitable partition.

_{n}, we run our recognition algorithm in time O(n

^{2}). If we have a generalised split graph, with a representation, we solve each of our four optimisation problems in time O(n

^{2.5}), if not, which happens with probability e

^{−Ω(n)}, we run the methods from [4]. This simple idea yields a polynomial-time algorithm for each problem with low expected running time, and indeed the probability that the time bound is exceeded is exponentially small.

## Acknowledgments

## Author Contributions

## Conflicts of Interest

## References

- Prömel, H.J.; Steger, A. Almost all Berge graphs are perfect. Comb. Probab. Comput.
**1992**, 1, 53–79. [Google Scholar] - Cornuéjols, G.; Liu, X.; Vušković, K. A polynomial algorithm for recognizing perfect graphs, Proceedings of the 44th Annual IEEE Symposium on Foundations of Computer Science, Berkeley, CA, USA, 26–29 October 2013; pp. 20–27.
- Chudnovsky, M.; Cornuéjols, G.; Liu, X.; Seymour, P.; Vušković, K. Recognizing Berge graphs. Combinatorica
**2005**, 25, 143–186. [Google Scholar] - Grötschel, M.; Lovász, L.; Schrijver, A. Polynomial algorithms for perfect graphs. North-Holl. Math. Stud.
**1984**, 88, 325–356. [Google Scholar] - Eschen, E.M.; Wang, X. Algorithms for unipolar and generalized split graphs. Discrete Appl. Math.
**2014**, 162, 195–201. [Google Scholar] - Tyshkevich, R.; Chernyak, A. Algorithms for the canonical decomposition of a graph and recognizing polarity. Izvestia Akad. Nauk BSSR Ser. Fiz.-Mat. Nauk
**1985**, 6, 16–23. [Google Scholar] - Churchley, R.; Huang, J. Solving partition problems with colour-bipartitions. Graphs Comb.
**2014**, 30, 353–364. [Google Scholar] - Even, S.; Itai, A.; Shamir, A. On the complexity of timetable and multicommodity flow problems. SIAM J. Comput.
**1976**, 5, 691–703. [Google Scholar] - Aspvall, B.; Plass, M.F.; Tarjan, R.E. A linear-time algorithm for testing the truth of certain quantified boolean formulas. Inf. Process. Lett.
**1979**, 8, 121–123. [Google Scholar]

**Figure 1.**For the graph G

_{1}(

**left**) we have s(R, G

_{1}) = α(G

_{1}) for all representations R, and for the graph G

_{2}(

**right**) we have s(R, G

_{2}) = α(G

_{2}) + 1 for all representations R.

© 2015 by the authors; licensee MDPI, Basel, Switzerland This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

McDiarmid, C.; Yolov, N.
Recognition of Unipolar and Generalised Split Graphs. *Algorithms* **2015**, *8*, 46-59.
https://doi.org/10.3390/a8010046

**AMA Style**

McDiarmid C, Yolov N.
Recognition of Unipolar and Generalised Split Graphs. *Algorithms*. 2015; 8(1):46-59.
https://doi.org/10.3390/a8010046

**Chicago/Turabian Style**

McDiarmid, Colin, and Nikola Yolov.
2015. "Recognition of Unipolar and Generalised Split Graphs" *Algorithms* 8, no. 1: 46-59.
https://doi.org/10.3390/a8010046