Detecting and Enumerating Small Induced Subgraphs in c -Closed Graphs
DDetecting and Enumerating Small InducedSubgraphs in c -Closed Graphs Tomohiro Koana
Algorithmics and Computational Complexity, Faculty IV, TU Berlin, [email protected]
André Nichterlein
Algorithmics and Computational Complexity, Faculty IV, TU Berlin, [email protected]
Abstract
Fox et al. [SIAM J. Comp. 2020] introduced a new parameter, called c -closure, for a parameterizedstudy of clique enumeration problems. A graph G is c -closed if every pair of vertices with at least c common neighbors is adjacent. The c -closure of G is the smallest c such that G is c -closed. Wesystematically explore the impact of c -closure on the computational complexity of detecting andenumerating small induced subgraphs. More precisely, for each graph H on three or four vertices,we investigate parameterized polynomial-time algorithms for detecting H and for enumerating alloccurrences of H in a given c -closed graph. Theory of computation → Graph algorithms analysis
Keywords and phrases
FPT in P, combinatorial algorithms, subgraph detection, subgraph enumera-tion
Funding
Tomohiro Koana : Supported by the DFG project FPTinP (NI 369/16).
Detecting and enumerating a fixed subgraph H in a given host graph G is an importantand well-studied graph problem. Even the special cases for small subgraphs H have manyapplications e. g. in the analysis of protein–protein networks [20] or of social networks [21].We focus on the problem variants where H has three or four vertices, resulting in 15problem variants. Out of these 15 candidates for H , only three are known to be detectablein linear time: a path on three P or four P vertices [4] and the complement of a P (anedge plus an isolated vertex). For the remaining 12 subgraphs the (theoretically) fastestknown algorithms are based on fast matrix multiplication [13, 24] and mostly run in e O ( n ω ) time ( O ( n . ) for clique and independent set on four vertices). However, the fast matrixmultiplication is not practical due to its large overhead. We will thus focus on “combinatorial”algorithms. Although this term is not well-defined, it is usually used to denote algorithmswithout any use of fast matrix multiplication. These algorithms are often more efficient inpractice.Finding a combinatorial algorithm that detects a triangle in O ( n − ε ) for ε > c -closurewhich captures a natural property found often in social networks [8]: two vertices with manycommon neighbors tend to be adjacent. More formally, the c -closure of a graph is the smallestinteger c such that any two non-adjacent vertices have less than c common neighbors. The e O -notation suppresses polylogarithmic factors. Here O ( n ω ) is the time to multiply two n × n -matrices;it is known that ω < . a r X i v : . [ c s . D S ] J u l Detecting and Enumerating Small Induced Subgraphs in c -Closed Graphs An advantage of the c -closure is that its reasonably small in social networks with thousandsof vertices [8]. We provide FPT in P algorithms with a small polynomial dependency on c ,thus parameter-values which are prohibitively high for exponential-time algorithms are stillbe acceptable in our setting.Besides induced subgraph detection algorithms we also investigate the enumerationproblems. Here, we settle for all but four out of the 15 subgraphs the complexity on c -closedgraphs; see Table 1 for an overview on our results and existing work. Further Related Work.
We refer to Table 1 for an overview on prior results on subgraphdetection algorithms for three- and four-vertex subgraphs. As to subgraph enumeration, it isfolklore that for a graph H on k vertices, an algorithm that enumerates all induced copiesof H takes Θ( n k ) time (see Observation 4). For enumerating triangles, an O ( m / )-timealgorithm is provided by Itai and Rodeh [13].As to FPT in P, there are a few works on detecting and counting triangles [3, 5, 18].Kowaluk and Lingas [17] provided parameterized algorithms for several induced subgraphdetection problems where the subgraph has four vertices. Their parameter is the order ofthe largest clique in the host graph.Being a relatively new parameter, there is not much work on parameterized algorithmsexploiting the c -closure [8, 15, 16]. All maximal cliques can be enumerated in 3 c / · n O (1) time [8]. For constant c , they all showed that there are O ( n − − c ) maximal cliques in c -closed graphs, which was previously shown for c = 2 [7]. Dense subgraphs such as s -plexes, s -defective cliques, and bicliques can be enumerated in 2 c · n O (1) time [16]. Moreover,polynomial kernels for several NP-hard graph problems are known [15]. For k ∈ N , let [ k ] denote the set { , . . . , k } . Throughout the paper, we use G to denote anundirected graph. Let V ( G ) and E ( G ) be the vertex set and the edge set of G , respectively,with n = | V ( G ) | and m = | E ( G ) | . We will use G for the complement of G . For a vertex v ∈ V ( G ), let N ( v ) = { u | uv ∈ E ( G ) } and N [ v ] = N ( v ) ∪ { v } denote its open and closedneighborhood, respectively. The degree of a vertex v is deg( v ) = | N ( v ) | . A vertex v isuniversal if deg( v ) = n . For a vertex set S ⊆ V ( G ), the notation G [ S ] is used for thesubgraph induced by S . The path on k vertices is denoted by P k , the complete graph on k vertices is denoted by K k , and the complete bipartite graph with the parts containing k and ‘ vertices is denoted by K k,‘ . (cid:73) Definition 1 ([8]) . A graph G is c -closed if | N ( u ) ∩ N ( v ) | < c for all pairs of nonadjacentvertices u, v . The c -closure of G is the smallest integer c such that G is c -closed. Considering the landscape of graph parameters, the c -closure is obviously “smaller” thanthe maximum vertex degree ∆ of the graph, i. e., c ≤ ∆ + 1. Other (common) parameterssmaller than ∆ are minimum degree, degeneracy, acyclic chromatic number, and h -index [22].These parameters are unrelated to c -closure: they are all O (1) on a K ,n − ( c -closure is n − n ) on a K n ( c -closure is 1). These two examples also show that there are graphswith c · n ∈ Θ( m ) and graphs with c · n ∈ Θ( √ m ). In this section, we consider the three-vertex induced subgraphs. We start with the edgelesssubgraph. For constant k , it was shown that finding an independent set K k on k vertices in c - omohiro Koana, André Nichterlein 3 Table 1
Overview for combinatorial algorithms. The algorithms of Williams [24] are randomized;we use ω = 3 here to account for combinatorial algorithms. The graphs are sorted first by thenumber of vertices and second by the number of edges. For each graph the first row refers to therunning times on general graphs and the subsequent rows on c -closed graphs. Running time lowerbounds (indicated by Θ( · ) and Ω( · )) are mostly based on the number of possible occurrences of thesubgraph in general graphs (first row) and c -closed graphs for constant c (subsequent rows). Resultswithout reference are trivial and/or folklore and are discussed in Sections 3 and 4 for completeness.detection enumeration S e c t i o n K O ( n ) Θ( n ) [Obs. 4] O ( m + c ) [15] P Θ( n + m ) Θ( nm ) [Obs. 4] P Θ( n + m ) Θ( nm ) O ( cn + m / ) [Thm. 6]Triangle O ( m / ) [13] Θ( m / ) [13] O ( cn ), O ( c / m / ) [Thms. 8 and 10] S e c t i o n K O ( n ) Θ( n ) [Obs. 4] O ( m + c ) [15]co-diamond O ( m / ) [24] Θ( n m ) [Obs. 4] O ( m + c n ) [Thm. 21]co-paw O ( m / ) [24] Θ( nm ), Θ( n m ) O ( m + c ) [Cor. 18] O ( cn ), Ω( n ) [Thm. 12]co-square O ( n ), O ( m / ) [24] Θ( m ) [Obs. 4] O ( m + c / ) [Thm. 23] P Θ( n + m ) [4] Θ( m ) O ( cnm ) [Obs. 13]Ω( n . ), Ω( m ) [Thm. 16]claw O ( m / ) [24] Θ( n m )? O ( cn ), Ω( n ) [Thm. 12]co-claw O ( m / ) [24] Θ( nm / ) [Obs. 4]?paw O ( m / ) [24] Θ( m ) O ( cn ), O ( c / m / ) [Cor. 17] O ( cnm ), Ω( n ) [Obs. 13]square O ( n ), O ( m / ) [24] Θ( m ) O ( cm / ) [Thm. 14] O ( c n + m / ) [Thm. 12] O ( cm / ) [Thm. 14]Ω( n ), Ω( m / ) [Thm. 16]diamond O ( m / ) [6] Θ( m )? O ( c n + m / ) [Thm. 12]Ω( n ) K O ( m ) Θ( m ) [Obs. 4] O ( cn ) [Cor. 9] Detecting and Enumerating Small Induced Subgraphs in c -Closed Graphs closed graphs can be found in O ( m + c k ) time [15]. Thus, a K can be detected in O ( m + c )time. Enumerating all K k cannot be done in o ( n k ) time, even on c -closed graphs as anedgeless graph on n vertices is 1-closed and contains Θ( n k ) many K k ’s. This settles findingand enumerating K ’s.As a side result, we remark that the O ( m + c k )-time algorithm for detecting a K k can beused as subroutine to find stars. However, note that the subsequent result is not useful forfinding stars few leafs as the existing algorithms for finding a K , = P and a claw K , ongeneral graphs are faster (see Table 1). (cid:73) Theorem 2.
There is an O ( c k m − / k + m − / k ) -time algorithm to find an induced K ,k for constant k . Proof.
Let D = m / k . An induced K ,k in which the center is of degree at most D can befound in O ( D k − m ) = O ( m − / k ) time: There are m choices for the center and one of itsleaves and O ( D k − ) choices for the other k − K ,k where the center is a vertex v of degree at least D . This can be done by looking for anindependent set in N ( v ). Recall that an independent set of order k can be found in O ( m + c k )time [15]. Since there are O ( m / D ) vertices of degree at least D , the overall running timeis O ( m / D · ( m + c k )) = O ( c k m − / k + m − / k ). (cid:74) With the case of K being settled, we turn to the remaining three-vertex graphs: P , P , and K . As already mentioned by Williams et al. [24], one can find a P in linear time.As we were unable to find the corresponding algorithm in the literature, we provide one forcompleteness. (cid:73) Observation 3 (folklore) . There is an O ( n + m ) -time algorithm to find an induced P . Proof.
Assume that the input graph has at least one edge; otherwise there is no P . Furtherassume that there is no isolated vertex; otherwise the isolated vertex and any edge formsa P . Clearly, this assumptions can be checked in linear time.Partition the vertex into two parts V and V where V is the set of vertices of degree lessthan n/ − V = V \ V . One can check in O ( m ) time whether V is an independentset. If not, then u, v ∈ V with uv ∈ E is part of a P : Since | N [ { u, v } ] ≤ n −
2, there is avertex w ∈ V \ N [ { u, v } ]. Thus assume that V is an independent set.Next consider the case that there is a vertex v ∈ V with N ( v ) = V . Thus, there is avertex u ∈ V \ N ( v ). Since deg( u ) ≥ n/ − v ) < n/ − w ∈ N ( u ) \ N ( v ). Thus v, u, w forms a P . Note that v and u can be found (if oneexists) in linear time. Once u and v are fixed, one can find w with another linear-time scanof the graph.It remains to consider the case that for each vertex v ∈ V we have N ( v ) = V . Since V is an independent set, it follows that no vertex in V can be part in a P . Thus, it sufficesto look for a P ’s in G [ V ]. Since deg( v ) ≥ n/ v ∈ V , it follows that we cancompute G [ V ] in O ( n + m ) time. Moreover, we can find a P in G [ V ] in O ( n + m ) time . (cid:74) Note that all P ’s can be enumerated easily in O ( nm ) time: Enumerate all combinationsof one edge and one vertex and check whether they induce a P . The following observationshows that this running time bound is tight, even for 1-closed graphs. Note that each connected component that is not a clique contains a P , which can be found with asimple BFS from a non-universal vertex. omohiro Koana, André Nichterlein 5 Algorithm 1
An algorithm for enumerating P ’s. function EnumerateP3s ( G ) for all uv ∈ E ( G ) do for all w ∈ N ( u ) ∪ N ( v ) do if w / ∈ N ( u ) ∩ N ( w ) then output a P = ( u, v, w ). (cid:73) Observation 4 (folklore) . Let k be a constant. For every subgraph H on k vertices there isan n -vertex graph G containing Θ( n k ) distinct occurrences of H . Moreover, if H does notcontain an induced P , then G is -closed. Proof.
For a fixed H = ( { v , . . . , v k } , E ) on k vertices, let G be the graph obtained byreplacing each vertex with a clique of order n/k . Formally, let V ( G ) = ( { v ai | i ∈ [ k ] , a ∈ [ n/k ] } and E ( G ) = { v ai v bi | i ∈ [ k ] , a, b ∈ [ n/k ] } ∪ { v ai v bj | v i v j ∈ E, a, b ∈ [ n/k ] } . Clearly, foreach combination a , a , . . . , a k ∈ [ n/k ], the graph G [ { v a , v a , . . . , v a k k } ] is isomorphic to H .This show the first part.As to the second part, observe that if H does not contain an induced P , then H is acluster graph. By construction, it follows that also G is a cluster graph thus is 1-closed. (cid:74) We continue with P ’s. As a P can be found in linear time , there is no need to consider c -closed graphs for the detection problem. We thus turn to enumeration. First, observe thata start K ,n contains Θ( n ) many P ’s and is 2-closed. Thus, the following upper bound onthe number of P ’s is tight. (cid:73) Lemma 5. A c -closed graph G has O ( cn ) induced P ’s. Proof.
Let P be the set of all P ’s in G and let P uv be the set of all P ’s with endpoints u and v . By definition, P = S uv / ∈ E ( G ) P uv . Since G is c -closed, |P uv | < c for each uv / ∈ E ( G ).Thus, we obtain |P | = P uv / ∈ E ( G ) |P uv | < c (cid:0) n (cid:1) = O ( cn ). (cid:74) Hoàng et al. [12] showed that Algorithm 1 runs in O ( m +( P )+( K )) time, where ( P )and ( K ) are the number of P ’s and K ’s, respectively: The algorithm considers eachedge uv and each vertex w incident with uv . Thus, u , v , and w form either a P or a triangle.Since ( K ) ∈ O ( m / ) [13], we obtain the following theorem: (cid:73) Theorem 6.
There is an O ( cn + m / ) -time algorithm to enumerate all P ’s. Fox et al. [8] showed that a set of cliques containing all maximal cliques can be enumeratedin O ( p ( n, c ) + 3 c / n ) time, where p ( n, c ) is the time complexity to list all induced P ’s.They noted that p ( n, c ) = O ( cn o (1) + c − ω − α n ω + n ω log n ) due to the result of Gasieniecet al. [10], where ω and α are the the matrix multiplication exponent and the dual exponentof matrix multiplication, respectively. Using Theorem 6 to bound p ( n, c ) gives the following: (cid:73) Corollary 7.
There is an O ( m / + 3 c / n ) -time algorithm to find a set of cliques containingall maximal cliques. We can adapt Algorithm 1 to an algorithm for finding a triangle: As mentioned above,we find either a triangle or P in Line 4 of Algorithm 1. In order to find a triangle in O ( cn )time, we just terminate the algorithm as soon as one is detected. (cid:73) Theorem 8.
There is an O ( cn ) -time algorithm to find a triangle. (cid:73) Corollary 9.
There is an O ( cn k − ) -time algorithm to find a clique K k of size k . Detecting and Enumerating Small Induced Subgraphs in c -Closed Graphs Proof.
For each subset S of k − T v ∈ S N ( v )in O ( cn ) time by Theorem 8. (cid:74) Next, we develop a more efficient algorithm for finding a triangle in sparse graphs. (cid:73)
Theorem 10.
There is an O ( c / m / ) -time algorithm to find a triangle. Proof.
Let D = c / m / . Let V be the set of vertices with degree at least D and let V = V ( G ) \ V . Note that | V | ∈ O ( m / D ). If there is a triangle in G [ V ], then it can be foundin O ( c ( m / D ) ) = O ( c / m / ) time by Theorem 8. If there is a triangle containing at leastone vertex of V , then it can be found in O ( mD ) = O ( c / m / ) time. (cid:74) As to enumerating triangles, it follows from Observation 4 that the O ( m / )-time algorithmof Itai and Rodeh [13] cannot be improved even in 1-closed graphs.As a side-result, we also show that by enumerating all P ’s, one can compute the c -closure. (cid:73) Theorem 11.
There is an O ( cn + m / ) -time algorithm to compute the c -closure. Proof.
We first enumerate all P ’s in O ( cn + m / ) time. Let P be the set of all P ’s andlet P uv be the set of all P ’s with endpoints u and v . Once we obtain P by Theorem 6in O ( cn + m / ) time, one can find all P uv in O ( |P | ) time with a radix sort (recallthat |P | ∈ O ( cn ) by Lemma 5). Then the c -closure of G equals max uv / ∈ E ( G ) |P uv | + 1. (cid:74) We remark that deciding whether a graph is 2-closed requires O ( nm / ) time [7]. In this section, we consider four-vertex subgraphs. We turn our attention first to theenumeration aspect and then to the detection part.
Algorithms.
Recall that if our four-vertex subgraph H does not contain an induced P ,then Observation 4 excludes algorithms with running time O ( f ( c ) n − ε ) for any function f and any ε >
0. This applies to five of the eleven subgraphs: co-diamond, co-square, co-claw,and K . Interestingly, as we show below, we can have algorithms with running time O ( cn )or better for the other six subgraphs, namely, co-paw, P , claw K , , paw, square C , anddiamond. This is implied by the next simple but general theorem. Before stating the theorem,we need some more notation: For a graph H , let i ( H ) be the minimum size of a vertexset S such that each vertex in V ( H ) \ S has at least two nonadjacent neighbors in S . Forinstance, i ( C ) = 2, i ( K , ) = 3, and i ( K ) = i ( K ) = 4. (cid:73) Theorem 12.
Let H be a graph. There is an O ( c | V ( H ) |− i ( H ) n i ( H ) + cn + m / ) timealgorithm to enumerate induced copies of H . Proof.
We first compute the set N ( u ) ∩ N ( v ) for each pair u, v of nonadjacent vertices. Wecan do so by enumerating all P ’s using Algorithm 1 in O ( cn + m / ) time. We considereach choice S of | V ( H ) | − i ( G ) vertices such that each vertex in V ( H ) \ S has at least twononadjacent vertices. For V ( H ) \ S , there are c | V ( H ) |− i ( H ) choices. (cid:74) This algorithm can enumerate squares and diamonds in O ( m / + c n ) time and co-paws, P ’s, claws, and paws in O ( cn ) time. Note that we can construct O (1)-close graphscontaining Θ( n ) co-paws, claws, or paws respectively (see discussion in the second part of omohiro Koana, André Nichterlein 7 this subsection). However, for P , square, and diamond we do not have fitting lower bounds(in terms of c and n ).For P ’s, paws, and squares we found alternative bounds. As we see in the second part ofthis subsection the running time of the following algorithm for P ’s and paws is tight. (cid:73) Observation 13.
There is an an O ( cnm ) -time algorithm to enumerate all induced P ’sand all paws. Proof.
By considering all combinations of one edge and one vertex, one fixes three verticesin a P (a paw). For P ’s (paws) assume the non-fixed vertex is one of the two degree-twovertices (the degree-three vertex). It follows from the definition of c -closure that there areat most c − O ( cn + m / ) time. This results in an O ( cnm )-time algorithm. (cid:74) As we shall in the second part of this section, there are 3-closed graphs with Θ( m / )induced copies of C . Thus, the running time of the following algorithm could still beimproved slightly. (cid:73) Theorem 14.
There is an an O ( cm / ) -time algorithm to enumerate all induced squares. Proof.
Let D = c / m / . We call a vertex high-degree if its degree is at least D andlow-degree otherwise. We consider two cases based on which vertices of the square arehigh-degree. (i) Two consecutive vertices are low-degree: First, we consider each edge uv where bothendpoints u and v are of low-degree. Then, we consider each neighbors u and v of u and v , respectively. We list the square ( u, v, v , u ) if uv , u v, u v / ∈ E ( G ). Thisrequires O ( D m ) = O ( cm / ) time. (ii) Two opposite vertices are high-degree: We first enumerate all P ’s where both endpointsare high-degree in O ( c ( m / D ) + m / ) time. We achieve this by adapting Algorithm 1:We consider each edge uv where at least one endpoint is high-degree in Line 2 instead.Without loss of generality, assume that u is high-degree. Moreover, we consider eachhigh-degree neighbor w of v in Line 3 instead. Then, this algorithm spends O (1) timefor each triangle or P whose endpoints are both high-degree. Since there are O ( m / )triangles and O ( c ( m / D ) ) P ’s whose endpoints are both high-degree, this adaptation ofAlgorithm 1 takes O ( c ( m / D ) + m / ) time. Thus, we have the set of common neighborsof each pair of nonadjacent high-degree vertices. Now we can enumerate all squareswhere two opposite vertices are high-degree in O ( c ( m / D ) ) = O ( cm / ) time.Overall, all squares are listed in O ( cm / ) time. (cid:74) (Tight) Lower bounds. We now provide (almost) fitting lower bounds. Whenever possible,we replace factors of n by factors of m (mostly replacing n by m ). This is done via thefollowing simple observation. (cid:73) Observation 15.
For a graph H of constant size, there is an O ( n | V ( H ) |− ν ( H ) m ν ( H ) ) -timealgorithm to enumerate all induced copies of H , where ν ( H ) is the maximum matching sizeof H . Proof.
We consider each choice for the set V of | V ( H ) | − ν ( H ) vertices and the set E of ν ( H ) edges. Note that there are n | V ( H ) |− ν ( H ) m ν ( H ) such choices. Since H of constant size,whether V ∪ V ( E ) forms an induced H can be checked in constant time. (cid:74) Detecting and Enumerating Small Induced Subgraphs in c -Closed Graphs Observations 4 and 15 yield matching running time upper and lower bounds even in1-closed graphs for the task of enumerating K ’s, co-diamonds, co-squares, co-claws, or K ’s.The remaining six cases are discussed below (in the order they are listed in Table 1)Start with a co-paw. The upper bound O ( n m ) and O ( nm ) follow by simple brute forceselecting i ∈ [2] edges and 3 − i vertices (as in Observation 15). As to the lower boundconsider the disjoint union of an independent set and a star K n/ + K ,n/ − : It is 2-closedand has m = Θ( n ) edges and contains Θ( cn ) = Θ( n ) co-paws.As to P ’s, observe that again the upper bound O ( m ) follows from Observation 15. Asto the lower bound, consider the graph resulting from making the centers of two K ,n/ − ’sadjacent: it is 2-closed and contains Θ( n ) = Θ( m ) = Θ( cnm ) many P ’s. Note that thislower bound fits to the algorithm in Observation 13 but leaves a gap to the O ( cn )-timealgorithm following from Theorem 12. Interestingly, we can improve the lower bound asstated in the next theorem, but also the the new lower bound does not match the O ( cn )upper bound. (cid:73) Theorem 16.
There is an infinite family of -closed graphs containing Θ( n / ) P ’s and Θ( n + m / ) squares. Proof.
Suppose that n = p + p + 1 for an integer p > P on n points and n lines. It fulfills the following properties: For any pair of points (lines), there is exactly one line incident with both points (points). Each point (line) is incident with exactly p + 1 lines (points).See e.g. Albert and Sandler [2] for more on projective planes.Now consider the graph G constructed as follows: We introduce vertices u , u for eachpoint u of P and vertices v , v for each line v of P . Then, we add an edge u u for eachpoint u and v v for each line v . We also add edges u v , u v , u v , u v for each pair ofpoint u and line v that are incident in P . The constructed graph G is 3-closed: For twodistinct points u and u (lines v and v ), the vertices u i and u j ( v i and v j ) for i, j ∈ [2] haveexactly two common neighbors by the first property of projective planes. For a non-incidentpair of a point u and a line v , the vertices u i and v j for i, j ∈ [2] have no common neighbor.Moreover, G has n = 4 n vertices and m = 4 pn + 6 n ∈ Θ( n / ) edges by the second propertyof projective planes.Finally, we count the number of P ’s and squares. We begin with P ’s. Let u and u bedistinct points. By the properties of projective planes, there is exactly one line v on whichboth u and u lie and there are exactly p lines that are incident with u and not with u .Let v be one of these p lines. Observe that ( u , v , u , v ) is a P in G . Hence, G hasΘ( pn ) = Θ( n / ) = Θ( m / ) P ’s. Next, we consider squares. For each pair of distinct points u and u , there exists an induced C on ( u , v , u , v ), where v is the line incident with both u and u . Thus, there are Θ( n ) = Θ( m / ) squares in G . (cid:74) We remark that a construction similar to the above one was used to show a lower boundon the number of maximal cliques in 2-closed graphs by Eschen et al. [7].Continuing with claws, observe that the upper bound O ( n m ) follows from Observation 15.As to the lower bound, consider a star K ,n − : it is 2-closed and contains Θ( cn ) = Θ( n m )claws.As to paws, observe that again O ( m ) time follows from Observation 15. For the lowerbound, consider a clique K n/ where at one vertex of the clique there are n/ cn ) = Θ( n ) paws. omohiro Koana, André Nichterlein 9 Next, consider squares. Again, O ( m ) time follows from Observation 15. A lower boundis provided in Theorem 16. Note that it does not match the upper bound O ( m / + c n )that follows from Theorem 12.Finally, consider diamonds. Observe that again O ( m ) time follows from Observation 15.As for lower bounds, consider a graph obtained by making the two high-degree vertices ina K ,n − adjacent. This graph is 3-closed and has Θ( c n ) = Θ( n ) = Θ( m ) diamonds:combining the two high-degree vertices with any two independent-set vertices form a diamond.Note that the algorithm following from Theorem 12 has an additional O ( m / ) term in itsrunning time which means it not tight. In this section, we provide efficient algorithms for five out of the eleven induced subgraphdetection problems on c -closed graphs, namely for the subgraphs co-diamond, co-paw, co-square, paw, and square. Note that a P can be found in linear time [4], thus there is noroom for improvement. For K a faster algorithm on c -closed graphs is known [15] (see alsofirst paragraph of Section 3). Hence, for four subgraphs, namely claw, co-claw, diamond,and K , the question for fast algorithms on c -closed graphs remain open.Out of the five positive results, detecting a co-diamond and a co-square require newalgorithms. For the remaining three subgraph, the results either directly from Theorem 14 (forsquare) or from known characterizations via induced three-vertex subgraphs and results fromSection 3 (for co-paw and paw). We start by briefly discussing the latter (co-paw and paw).Afterwards, we show the algorithms for detecting a co-diamond and a co-square. Finally,we provide a algorithm for detecting a diamond in a gem-free c -closed graph. Moreover, wehighlight the issue that needs to be resolved in order to remove the gem-free assumption. Co-paw and paw.
We use the characterization of Olariu [19]: A graph is a paw-free if andonly if it is triangle-free or P -free. Thus, we immediately obtain the following corollary fromObservation 3 and Theorems 8 and 10. (cid:73) Corollary 17.
There is an O (min { cn , c / m / } ) -time algorithm to detect an induced paw. (cid:73) Corollary 18.
There is an O ( m + c ) -time algorithm to detect an induced co-paw. Proof.
Due to the result of Olariu [19], it suffices to find a P and K in the input graph G : G is co-paw-free ⇐⇒ G is paw-free [19] ⇐⇒ G is K -free or P -free ⇐⇒ G is K -free or P -free.An induced P can be found in O ( n + m ) time and an independent set of order three can befound in O ( m + c ) time [15]. (cid:74) Co-diamond.
We next present our algorithm detecting co-diamonds, which is based on thefollowing structural statements. (cid:73)
Lemma 19.
If there is a maximal clique C of order at least c in G , then either V ( G ) \ C is a clique or G contains a co-diamond. Proof. If V ( G ) \ C is a clique, then clearly the graph G is co-diamond-free. It remains toshow that if V ( G ) \ C is not a clique, then G contains a diamond. To this end, let uv / ∈ E ( G )for u, v ∈ V ( G ) \ C . Since C is maximal, there exist vertices u , v ∈ C such that uu , vv / ∈ c -Closed Graphs E ( G ). By the c -closure, we have that | N ( u ) ∩ C | < c and that | N ( v ) ∩ C | < c . Therefore, | C \ N [ { u, v } ] | ≥
2. For w, w ∈ C \ N [ { u, v } ], the four vertices ( u, v, w, w ) forms an inducedco-diamond. (cid:74) In our algorithm, we will use the following statement, which is a small reformulation ofLemma 19. (cid:73)
Lemma 20.
Let G be a graph that cannot be partitioned into two cliques. If there is aclique C of order at least c in G , then G contains a co-diamond. Proof. If C is maximal, then the statement directly follows from Lemma 19. Otherwise,let C be a maximal clique containing C . Clearly, C is of order at least 2 c . Moreover,since V ( G ) cannot be partitioned into two cliques, it follows that V ( G ) \ C is not a clique.Thus, the statement again follows from Lemma 19. (cid:74)(cid:73) Theorem 21.
There is an O ( m + c n ) -time algorithm to detect an induced co-diamond. Proof. If n ≤ c , then we can determine whether the input graph G has an induced co-diamond in O ( c ) time, using the O ( m / )-time algorithm of Eisenbrand and Grandoni [6].So assume that n ≥ c .Then, we determine whether the vertex set V ( G ) can be partitioned into two cliques C and C . If m < (cid:0) n/ (cid:1) , then this is impossible (at least one clique needs to be of order n/ m ≥ (cid:0) n/ (cid:1) ∈ Θ( n ). Hence, in O ( m ) time we can simply check whetherthe complement G of G is bipartite. Suppose that there are two cliques C and C suchthat C ∪ C = V ( G ). Then, we can conclude that G has no induced co-diamond. Thus, weassume in the following that V ( G ) cannot be partitioned into two cliques (note that thisallows us to invoke Lemma 20).We claim that if there is an edge uw such that deg( u ) ≤ c and deg( w ) ≤ c , then G has an induced co-diamond. Since n ≥ c , we have | V ( G ) \ N [ { u, w } ] | ≥ n − c ≥ c .If V ( G ) \ N [ { u, w } ] is a clique (which can be checked in O ( m ) time), then by Lemma 20 thereis a co-diamond in G . Hence, assume there exist nonadjacent vertices v, v ∈ V ( G ) \ N [ { u, w } ].However, then ( u, w, v, v ) forms an induced co-diamond. Note that such an induced co-diamond can be found in O ( m ) time.Next, consider the case that there is a vertex v such that 2 c < deg( v ) ≤ n − c . Weclaim that G has an induced co-diamond in this case. Note that | V ( G ) \ N [ v ] | ≥ c . Hence,if V ( G ) \ N [ v ] is a clique, then by Lemma 20 there is a co-diamond in G . Otherwise, thereexist nonadjacent vertices u, w ∈ V ( G ) \ N [ v ]. Moreover, there exists a vertex v ∈ N ( v )that is adjacent to neither u nor w : The c -closure of G yields that | N ( v ) \ N ( { u, w } ) | ≥| N ( v ) | − | N ( v ) ∩ N ( u ) | − | N ( v ) ∩ N ( w ) | > c − c − >
0. Thus, we find an inducedco-diamond ( u, w, v, v ). Hence, we assume in the following that each vertex has a degree ofat most 2 c or at least n − c + 1.It remains to consider the case that each edge contains a vertex of degree at least n − c +1.We iterate over all these high-degree vertex; let v be such a vertex of degree at least n − c + 1.To find an co-diamond where v is one of its degree-one vertices, we simply check whether thereare nonadjacent pair u, w of vertices in V ( G ) \ N [ v ]. Since | V ( G ) \ N [ v ] | < c , we can find u and w (if existing) in O ( c ) time. If there is no such pair, then we can conclude that G hasno induced co-diamond containing v . Otherwise, there is an induced co-diamond ( u, w, v, v )for v ∈ N ( v ) \ N [ { u, w } ]. Note that N ( v ) \ N [ { u, v } ] = ∅ by the same argument above.Since we spend O ( c ) time for each vertex of degree at least n − c , this step requires O ( c n )time. (cid:74) omohiro Koana, André Nichterlein 11 Co-square.
We now consider co-squares. The next lemma plays an important role in ourco-square detection algorithms. (cid:73)
Lemma 22.
Suppose that there are vertices u, v ∈ V ( G ) such that deg( u ) ≥ c , deg( v ) ≥ c − , and uv / ∈ E ( G ) . Then, G contains an induced co-square. Proof.
Since G is c -closed, we have | N ( u ) ∩ N ( v ) | < c . It follows that | N ( u ) \ N ( v ) | = | N ( u ) | − | N ( u ) ∩ N ( v ) | >
0. Let w be an arbitrary vertex in N ( u ) \ N ( v ). Since vw / ∈ E ( G ),we have | N ( v ) ∩ N ( w ) | < c by the c -closure of G . Thus, | N ( v ) \ N ( { u, w } ) | ≥ | N ( v ) | −| N ( u ) ∩ N ( v ) | − | N ( v ) ∩ N ( w ) | >
0. For an arbitrary vertex v ∈ N ( v ) \ N ( { u, v } ), thevertices ( u, w, v, v ) form an induced co-square. (cid:74) We say that a connected component is trivial if it consists of one vertex. (cid:73)
Theorem 23.
There is an O ( m + c / ) -time randomized algorithm to detect an inducedco-square. Proof.
Let C be the set of vertices of degree at least 2 c −
1. If C is not a clique, then G contains an induced co-square by Lemma 22. So assume that C is a clique. Let S , . . . , S ‘ bethe connected components of G − C . If all components are trivial, then there is no inducedco-square. Moreover, if there are more than one non-trivial connected component, we findan induced co-square. Thus, we assume that there is exactly one connected component S with at least one edge.If there is no co-square in S , then the diameter of G [ S ] is at most three. Since every vertexin S has degree at most 2 c −
2, we can assume that | S | ∈ O ( c ). Furthermore, if | C | ≥ c ,then there is an induced co-square. For each vertex v ∈ S , there exists a vertex in C that isnot adjacent to v , because | C | ≥ c and v has at most 2 c − c -closureof G yields that each vertex v ∈ S has at most c − C . Consequently, for anedge vv ∈ E ( G [ S ]), there are two vertices u, w ∈ C that are not adjacent to v or v , whichform a co-square along with v and v . Hence, we can also assume that | C | ≤ c .Let I = V ( G ) \ ( C ∪ S ) be the set of isolated vertices in G − C . Now we describean O ( m + c )-time algorithm to find a co-square containing a vertex of I . For each vertex v ∈ C ,we check whether v has a neighbor in I . This can be done in O ( m ) time. Then, for eachvertex v ∈ C with at least one neighbor in I , we check whether there is an edge uw ∈ E ( G [ S ])such that u, w / ∈ N ( v ). If there is such an edge uw , then ( v, v , u, w ) is a co-square,where v ∈ I is a vertex adjacent to v . Otherwise, we can conclude that there is no co-squarecontaining a vertex of I . Note that this procedure takes O ( c ) time, because | C | ≤ c and | E ( G [ S ]) | ∈ O ( c ).Finally, it remains to find a co-square in G [ C ∪ S ]. Using the O ( m / )-time algorithm ofWilliams et al. [24], this can be done in O ( c / ). (cid:74) Diamond.
The following characterization for diamond-free graphs is used in algorithmsthat find a diamond and run in time O ( m / ) [6] and O (∆ m ) [14] respectively. (cid:73) Lemma 24 ([14, Lemma 3]) . A graph G is diamond-free if and only if G [ N ( v )] is P -freefor each vertex v ∈ V ( G ) . Using this characterization, we show that if the input graph does not contain any inducedgem (five-vertex graph formed by P and an additional universal vertex), then an induceddiamond can be detected in O ( cn ) time. (cid:73) Theorem 25.
There is an O ( cn ) -time algorithm to detect an induced diamond in gem-freegraphs. c -Closed Graphs Algorithm 2
An algorithm for finding a P or an independent set in the neighborhood of v . function FindIS ( G, v ) I ← ∅ , J ← N ( v ). while J = ∅ do . Each vertex in N ( v ) \ J has at least one neighbor in I . Let u be an arbitrary vertex in J . I ← I ∪ { u } . for all w ∈ N ( u ) do if w / ∈ N ( v ) then continue . if w / ∈ J then there is a P in G [ N ( v )]; return J ← J \ N [ u ] return I . Proof.
We show that for each vertex v ∈ V ( G ), one can verify in O ( cn ) time whether G [ N ( v )]is P -free. By Lemma 24, this yields an O ( cn )-time algorithm for finding a diamond. First,we use an O ( cn )-time algorithm (Algorithm 2) that determines that either G [ N ( v )] is not P -free, orthere is an inclusion-maximal independent set I ⊆ N ( v ) in G [ N ( v )] such that N ( u ) ∩ N ( w ) ∩ N ( v ) = ∅ for all u, w ∈ I .Basically, Algorithm 2 keeps adding some vertex u ∈ J to an independent set I , until thereis no vertex left in J . In doing so, Algorithm 2 removes neighbors of u from J . Supposethat u has a neighbor w not in J (Line 8). Then, there is a P , because w has a neighborin I \ { u } . We emphasize that Algorithm 2 only requires the adjacency list of G ; we avoidconstructing the adjacency list of G [ N ( v )], since it could take Ω( m ) time.We show that the time complexity of Algorithm 2 is O ( cn ). In particular, considerthe case Algorithm 2 finds an independent set I (the proof is analogous for the other caseAlgorithm 2 finds a P ). For each vertices u ∈ I and w ∈ N ( u ), Algorithm 2 spends O (1)time. It clearly holds that | S u ∈ I N ( u ) | = | S u ∈ I N ( u ) ∩ N ( v ) | + | S u ∈ I N ( u ) \ N ( v ) | . Since N ( u ) ∩ N ( u ) ∩ N ( v ) = ∅ for all u, u ∈ I by the choice of I , we have | S u ∈ I N ( u ) ∩ N ( v ) | ≤ deg( v ) ∈ O ( n ). Moreover, we have | S u ∈ I N ( u ) \ N ( v ) | < cn : To see why, note that thereis a P on ( v, u, w ) for each vertex w ∈ N ( u ) \ N ( v ). For each choice of w / ∈ N ( v ), thevertices v and w have at most c − G is c -closed. Thus, | S u ∈ I N ( u ) | ∈ O ( cn ) and, therefore, Algorithm 2 executes in O ( cn ) time.If Algorithm 2 finds a P in the neighborhood of v , then we immediately find a diamondin G . Thus, assume that Algorithm 2 returns an independent set I . Let S u = N ( u ) ∩ N ( v )for each u ∈ I . Note that S u is pairwise disjoint for all N u by the construction of I . Since G is gem-free, there is no edge ww ∈ E ( G ) such that w ∈ S u and w ∈ S u for u = u ∈ I .Thus, in order to decide whether there is a P in N ( v ) it remains to decide whether S u is a clique or not for all u ∈ I . Let I = { u ∈ I | | S u | ≤ c } and let I = I \ I . Foreach u ∈ I , we verify whether all the vertices in S u are pairwise adjacent. This takes P u ∈ I | S u | ≤ c P u ∈ I | S u | ≤ c · deg( v ) ∈ O ( cn ) time. For each u ∈ I , we do as follows:Let T ⊆ S v be an arbitrary subset of exactly c vertices. We verify that the vertices in T are pairwise adjacent in O ( c ) time. Then, we verify whether w and w are adjacent foreach vertices w ∈ T and w ∈ T \ S v . If ww / ∈ E ( G ) for some w ∈ T and w ∈ T \ S v ,then ( w, u, w ) forms a P . Otherwise, S v is a clique: By the c -closure of G , any pair ofvertices with at least c common neighbors are necessarily adjacent. It is easy to see thatthis procedure takes O ( c + c · | S u | ) time for each u ∈ I . Since deg( v ) ≥ c · | I | , its overallrunning time is O ( P u ∈ I c + P u ∈ I c · | S u | ) = O ( deg( v ) / c · c + c · deg( v )) = O ( cn ). (cid:74) EFERENCES 13
Unfortunately, we were unable to get rid of the condition of the input graph being gem-freein the above theorem. One obstacle for this the following: We do not know whether onecan compute the common neighborhood for each pair of non-adjacent vertices in O ( cn )time, despite the output being of size O ( cn ). If this could be done, then there would beeasy O ( cn ) and O ( c n )-time brute-force algorithms for enumerating all P ’s and diamondsrespectively. We provided a first systematic study of detecting and enumerating small subgraphs in agiven c -closed host graph. While we provide several upper and lower bounds, there remain acouple of open questions (see question marks in Table 1). Probably the most important oneis whether the common neighborhood for each pair of non-adjacent vertices can be computedin O ( cn ) time. A positive answer would immediately improve several of our results. Inparticular, it would provide tight algorithms for enumerating P ’s, squares, and diamonds.Moreover, it would give first subcubic-time algorithms for detecting diamonds in c -closedgraph. Investigating parameterized algorithms for the problems studied in this work withrespect to the weak c -closure [8] (a related but smaller parameter than c -closure) is a furthertask for future research. Finally, besides detecting and enumerating subgraphs, the task ofcounting subgraphs is also relevant and not studied so far for c -closed host graphs. References A. Abboud and V. Vassilevska Williams. Popular conjectures imply strong lower boundsfor dynamic problems. In
Proceedings of the 55th Annual IEEE Symposium on Foundationsof Computer Science (FOCS ’14) , pages 434–443. IEEE Computer Society, 2014. 1 A. A. Albert and R. Sandler.
An introduction to finite projective planes . Dover, 2015. 8 M. Bentert, T. Fluschnik, A. Nichterlein, and R. Niedermeier. Parameterized aspects oftriangle enumeration.
Journal of Computer and System Sciences , 103:61–77, 2019. doi:10.1016/j.jcss.2019.02.004. 2 D. G. Corneil, Y. Perl, and L. K. Stewart. A linear recognition algorithm for cographs.
SIAM Journal on Computing , 14(4):926–934, 1985. doi: 10.1137/0214065. 1, 3, 9 D. Coudert, G. Ducoffe, and A. Popa. Fully polynomial FPT algorithms for some classesof bounded clique-width graphs.
ACM Transactions on Algorithms , 15(3):33:1–33:57,2019. doi: 10.1145/3310228. 2 F. Eisenbrand and F. Grandoni. On the complexity of fixed parameter clique anddominating set.
Theoretical Computer Science , 326(1-3):57–67, 2004. doi: 10.1016/j.tcs.2004.05.009. 3, 10, 11 E. M. Eschen, C. T. Hoàng, J. P. Spinrad, and R. Sritharan. On graphs without a C ora diamond. Discrete Applied Mathematics , 159(7):581–587, 2011. doi: 10.1016/j.dam.2010.04.015. 2, 6, 8 J. Fox, T. Roughgarden, C. Seshadhri, F. Wei, and N. Wein. Finding cliques in socialnetworks: A new distribution-free model.
SIAM Journal on Computing , 49(2):448–464,2020. doi: 10.1137/18M1210459. 1, 2, 5, 13 F. L. Gall. Powers of tensors and fast matrix multiplication. In
Proceedings of the 39thInternational Symposium on Symbolic and Algebraic Computation (ISSAC ’14) , pages296–303. ACM, 2014. 1 L. Gasieniec, M. Kowaluk, and A. Lingas. Faster multi-witnesses for boolean matrixmultiplication.
Information Processing Letters , 109(4):242–247, 2009. doi: 10.1016/j.ipl.2008.10.012. 5 A. C. Giannopoulou, G. B. Mertzios, and R. Niedermeier. Polynomial fixed-parameteralgorithms: A case study for longest path on interval graphs.
Theoretical ComputerScience , 689:67–95, 2017. 1 C. T. Hoàng, M. Kaminski, J. Sawada, and R. Sritharan. Finding and listing inducedpaths and cycles.
Discrete Applied Mathematics , 161(4-5):633–641, 2013. doi: 10.1016/j.dam.2012.01.024. 5 A. Itai and M. Rodeh. Finding a minimum circuit in a graph.
SIAM Journal onComputing , 7(4):413–423, 1978. doi: 10.1137/0207033. 1, 2, 3, 5, 6 T. Kloks, D. Kratsch, and H. Müller. Finding and counting small induced sub-graphs efficiently.
Information Processing Letters , 74(3-4):115–121, 2000. doi: 10.1016/S0020-0190(00)00047-8. 11 T. Koana, C. Komusiewicz, and F. Sommer. Exploiting c -closure in kernelization algo-rithms for graph problems. CoRR , abs/2005.03986, 2020. URL https://arxiv.org/abs/2005.03986 . Accepted to the 28th
Annual European Symposium on Algorithms(ESA ’20) . 2, 3, 4, 9 T. Koana, C. Komusiewicz, and F. Sommer. Computing dense and sparse subgraphsof weakly closed graphs.
CoRR , abs/2005.05630, 2020. URL https://arxiv.org/abs/2007.05630 . 2 M. Kowaluk and A. Lingas. A fast deterministic detection of small pattern graphsin graphs without large cliques.
Theoretical Computer Science , 770:79–87, 2019. doi:10.1016/j.tcs.2018.10.028. 2 S. Kratsch and F. Nelles. Efficient and adaptive parameterized algorithms on modulardecompositions. In
Proceedings of the 26th Annual European Symposium on Algorithms,ESA 2018 , pages 55:1–55:15, 2018. doi: 10.4230/LIPIcs.ESA.2018.55. 2 S. Olariu. Paw-free graphs.
Informal Processing Letter , 28(1):53–54, 1988. doi: 10.1016/0020-0190(88)90143-3. 9 N. Pržulj, D. G. Corneil, and I. Jurisica. Efficient estimation of graphlet frequencydistributions in protein–protein interaction networks.
Bioinformatics , 22(8):974–980,2006. 1 T. A. Snijders, P. E. Pattison, G. L. Robins, and M. S. Handcock. New specifications forexponential random graph models.
Sociological methodology , 36(1):99–153, 2006. 1 M. Sorge and M. Weller. The graph parameter hierarchy. Manuscript, 2019. URL https://manyu.pro/assets/parameter-hierarchy.pdf . 2 V. V. Williams and R. R. Williams. Subcubic equivalences between path, matrix, andtriangle problems.
Journal of the ACM , 65(5):27:1–27:38, 2018. doi: 10.1145/3186893. 1 V. V. Williams, J. R. Wang, R. R. Williams, and H. Yu. Finding four-node subgraphs intriangle time. In