Generalized Line Graphs: Cartesian Products and Complexity of Recognition

Putting the concept of line graph in a more general setting, for a positive integer $k$, the $k$-line graph $L_k(G)$ of a graph $G$ has the $K_k$-subgraphs of $G$ as its vertices, and two vertices of $L_k(G)$ are adjacent if the corresponding copies of $K_k$ in $G$ share $k-1$ vertices. Then, 2-line graph is just the line graph in usual sense, whilst 3-line graph is also known as triangle graph. The $k$-anti-Gallai graph $\triangle_k(G)$ of $G$ is a specified subgraph of $L_k(G)$ in which two vertices are adjacent if the corresponding two $K_k$-subgraphs are contained in a common $K_{k+1}$-subgraph in $G$. We give a unified characterization for nontrivial connected graphs $G$ and $F$ such that the Cartesian product $G\Box F$ is a $k$-line graph. In particular for $k=3$, this answers the question of Bagga (2004), yielding the necessary and sufficient condition that $G$ is the line graph of a triangle-free graph and $F$ is a complete graph (or vice versa). We show that for any $k\ge 3$, the $k$-line graph of a connected graph $G$ is isomorphic to the line graph of $G$ if and only if $G=K_{k+2}$. Furthermore, we prove that the recognition problem of $k$-line graphs and that of $k$-anti-Gallai graphs are NP-complete for each $k\ge 3$.


Introduction
The line graph L(G) of a graph G has vertices representing the edges (K 2 -subgraphs) of G and two vertices in the line graph are adjacent if and only if the corresponding edges share a vertex (a K 1 subgraph) in G. The analogous notion in the dimension higher by one is the triangle graph T (G) of G whose vertices correspond to the triangles (K 3 -subgraphs) of G and the vertices representing triangles having a common edge (K 2 -subgraph) are adjacent. The natural generalization gives the notion of k-line graph, which together with its specified subgraph, the so-called k-anti-Gallai graph is the main subject of this paper.

Terminology
All graphs considered here are simple and undirected. The vertex set and the edge set of a graph G are denoted by V (G) and E(G), respectively. Throughout this paper, a k-clique of G will be meant as a complete K k ⊆ G subgraph. That is, inclusion-wise maximality is not required. For the sake of simplicity, if the meaning is clear from the context, we do not distinguish between a clique and its vertex set in notation (e.g., the vertex set of a clique C will also be denoted by C instead of V (C)). The clique number ω(G) is the maximum order of a clique contained in G. The Cartesian product of two graphs G and F , denoted by G F , has the ordered pairs (u, v) as its vertices where u ∈ V (G) and v ∈ V (F ), and two vertices (u, v) and (u , v ) are adjacent if u = u and v is adjacent to v or v = v and u is adjacent to u . If v i ∈ V (F ), the copy G i is the subgraph of G F induced by the vertex set V (G i ) = {(u j , v i ) : u j ∈ V (G)}. The copy F j for u j ∈ V (G) is meant similarly. The join G ∨ F of two vertex-disjoint graphs is the graph whose vertex set is V (G) ∪ V (F ) and two vertices u and v of G ∨ F are adjacent if and only if either uv ∈ E(G) ∪ E(F ), or u ∈ V (G) and v ∈ V (F ). The diamond is a 4-cycle with exactly one chord (or equivalently, the graph K 4 − e obtained from the complete graph K 4 by deleting exactly one edge). Given a graph F , a graph G is said to be F -free if it contains no induced subgraph isomorphic to F . Next, we define the two main concepts studied in this paper. For illustration, see Figure 1.
Definition 1. For an integer k 1, the k-line graph L k (G) of a graph G has vertices representing the k-cliques of G, and two vertices in L k (G) are adjacent if and only if the represented k-cliques of G intersect in a (k − 1)-clique.
For k = 1 the definition yields L 1 (G) = K n for every graph G of order n. Note that even the K 2 -free (edgeless) graph with n vertices has the complete graph K n as its 1-line graph. The 2-line graph L 2 (G) is the line graph of G in the usual sense. The 3-line graph is the triangle graph T (G). Definition 2. For an integer k 1, the k-anti-Gallai graph k (G) of a graph G has one vertex for each k-clique of G, and two vertices in k (G) are adjacent if and only if the union of the two k-cliques represented by them span a (k + 1)-clique in G.
Hence, k (G) is a subgraph of L k (G). For every graph G, its 1-anti-Gallai graph is G itself, whilst 2-anti-Gallai graph means anti-Gallai graph (denoted by (G)) in the usual sense. If a vertex c i of L k (G) or k (G) represents the k-clique C i of G, we say that c i is the image of C i and conversely, C i is the preimage of c i . In notation, if the context is clear, the preimage of c i is denoted either by C i or by C(c i ). A graph G is called k-line graph or k-anti-Gallai graph if there exists a graph G such that L k (G ) = G or k (G ) = G holds, respectively.

Results
The line graph operator is a classical subject in graph theory. From the rich literature here we mention only the forbidden subgraph characterization given by Beineke in 1970 [6]. The notion of the triangle graph and that of the k-line graph were introduced several times independently by different motivations, and studied from different points of view (see for example [5,7,8,9,12,15,16,18]). For earlier results on anti-Gallai and k-anti-Gallai graphs we refer the reader to the papers [4,10,13] and the book [15]. As relates the most recent works, Anand et al. answered a question of Le by showing that the recognition problem of anti-Gallai graphs is NP-complete [2], moreover an application of the anti-Gallai graphs to automate the discovery of ambiguous words is described in [1].
In this paper we study three related topics. The first one concerns a question of Bagga [5] asking for a characterization of graphs G for which G K n is a triangle graph. As a complete solution in a much more general setting, in Section 2 we give a necessary and sufficient condition for a Cartesian product G F to be a 3-line graph. Then, in Section 3, this result is generalized by establishing a unified characterization for G F to be a k-line graph, for every k 2. We also study the algorithmic hardness of recognition problems. Due to the forbidden subgraph characterization in [6], the 2-line graphs can be recognized in polynomial time. In contrast to this, we prove in Section 4 that the analogous problem is NP-complete for the triangle graphs. Then, in Section 5 the same hardness is established for k-line graphs for each fixed k 4. Via some lemmas and a constructive reduction, we obtain that recognizing k-anti-Gallai graphs is also NP-complete for each k 3. The latter result solves a problem raised by Anand et al. [2], extending their theorem from k = 2 to larger values of k.
In Section 6, graphs with L k (G) ∼ = L(G) are identified for each k 3. Finally, in the concluding section we put some remarks and formalize a problem which remains open.

Some basic facts
Here we list some basic statements, which can be found in [15] or can be proved directly from the definitions.
Observation 2. Every clique K n of a k-line graph L k (G) either corresponds to n kcliques of G sharing a fixed (k − 1)-clique, or corresponds to n k-cliques contained in a common K k+1 . In particular, every clique of order n in a triangle graph T (G) corresponds to n triangles of G which are either incident with a fixed edge, or contained in a common K 4 .
Proof. Let c 1 , . . . , c n be the vertices of an n-clique K n of L k (G) and C 1 , . . . , C n be the corresponding k-cliques in G. Moreover, let v 1 , . . . , v k ∈ V (G) be the vertices which induce C 1 . Since c 2 is adjacent to c 1 in L k (G), the k-clique C 2 has precisely one vertex outside C 1 . We assume without loss of generality that C 2 = {u, v 2 , v 3 , . . . , v k }. Now, suppose that there exists a vertex in K n , say c 3 , such that its preimage C 3 does not contain some vertex from the set C 1 ∩ C 2 = {v 2 , v 3 , . . . , v k }; say, v k is omitted. In this case, since c 3 is adjacent to both c 1 and c 2 , the k-clique C 3 must be induced by {u, v 1 , v 2 , . . . , v k−1 }. Then, for any further vertex c i , the preimage must be of the form C i = {u, v 1 , v 2 , . . . , v k } \ {v j i } for some 2 j i k − 1. This proves that if not all the intersections C i ∩ C j are the same, then each of the k-cliques C 1 , . . . , C n is contained in the (k + 1)-clique {u, v 1 , v 2 , . . . , v k }.
Observation 3. If G is the k-line graph of a K k+1 -free graph, then for every k > k, G is also the k -line graph of a K k +1 -free graph.

Cartesian product and triangle graphs
In this section we solve a problem posed in [5] by Bagga.
Theorem 4. The Cartesian product G F of two nontrivial connected graphs is a triangle graph if and only if F is a complete graph and G is the line graph of a triangle-free graph (or vice versa).
Before proving the theorem we verify a lemma.
Lemma 5. If G contains a diamond as an induced subgraph then G K n is not a triangle graph for n 2.
Proof. To prove the lemma we apply the following result from [5].
( * ) If H is a triangle graph with K 4 − e as an induced subgraph, then there exists a vertex x in H such that x is adjacent to three vertices of one triangle of K 4 − e and nonadjacent to the fourth vertex.
Let G be a graph which contains a diamond induced by the vertices u 1 , u 2 , u 3 and u 4 , where (u 1 , u 4 ) is the non-adjacent vertex pair. Assume for a contradiction that there exists a graph H whose triangle graph is G K n for some n 2. Let v 1 ∈ V (K n ). Then, Since G K n is a triangle graph, by ( * ), it must contain a vertex (u 5 , v 1 ) which is adjacent to all vertices of one of the triangles in the diamond and not adjacent to the fourth vertex. Let (u 4 , v 1 ) be the vertex which is not adjacent to (u 5 , v 1 ). Let t i be the triangle in H corresponding to the vertex (u i , v 1 ) in G K n for i = 1, . . . , 5. Then t 1 , t 2 , t 3 and t 5 must be the triangles of a K 4 and t 4 is a triangle which shares the edge which is common to the triangles t 2 and t 3 . Let v 2 ∈ V (K n ) \ {v 1 } (it exists, since n 2). Then (u 1 , v 2 ) is adjacent to (u i , v 1 ) only for i = 1. Therefore, the triangle in H corresponding to the vertex (u 1 , v 2 ) must share an edge with t 1 and not with any other t i for i = 2, . . . , 5. But, each edge of t 1 is shared with at least one among t 2 , t 3 and t 5 , which gives a contradiction. Therefore, G K n is not a triangle graph.
Proof of Theorem 4. If both G and F are non-complete graphs, then G F contains an induced K 1,4 ⊂ P 3 P 3 and hence, by Observation 1, it is not a triangle graph. So we can assume that F = K n for some n 2.
If G is not a line graph, then by the theorem of Beineke [6], G contains one of the nine forbidden subgraphs as an induced subgraph (see Figure 2). If it is K 1,3 , then G K n contains an induced K 1,4 , which is forbidden for triangle graphs. In the case of any of the remaining eight graphs, G contains an induced diamond and hence, by Lemma 5, G K n cannot be a triangle graph. Let G be the line graph of a graph H which contains a triangle. Let T = (u 1 , u 2 , u 3 ) be a triangle in H. If H = K 3 , there exists a vertex u 4 adjacent to some u i in T (not necessarily to u i alone). But, then G = L(H) contains a diamond and hence by Lemma Conversely, let G be the line graph of a triangle-free graph H. Then T (H ∨ K n ) = G K n , completing the proof of the theorem.
Concerning edgeless graphs, note that G K 1 ∼ = G, and hence the characterization problem of graphs G such that G K 1 is a triangle graph is equivalent to characterizing triangle graphs.

Cartesian product and k-line graphs
As proved in Section 2, if both G and F are nontrivial connected graphs, G F is a triangle graph if and only if one of G and F is a line graph of a K 3 -free graph and the other one is a complete graph. We will see that a direct analogue of this theorem is not valid for k-line graphs in general. For instance, one can observe that the grid graph P n P m is a k-line graph for every n, m and k 4.
Our main result in this section is the following theorem, which gives a necessary and sufficient condition for a product G F of non-edgeless graphs to be a k-line graph. Recall that k-line graphs were defined for k = 1, too.
Theorem 6. For every k 2, the product G F of two non-edgeless connected graphs is a k-line graph if and only if there exist positive integers k 1 and k 2 such that G is the k 1 -line graph of a K k 1 +1 -free graph, F is the k 2 -line graph of a K k 2 +1 -free graph and k 1 + k 2 k holds. If F is a complete graph then it is the k 2 -line graph of a K k 2 +1 -free graph for every k 2 1. (For example, K n = L k 2 (K k 2 −1 ∨ nK 1 ) for all k 2 1, where the degenerate case k 2 = 1 simply means that K n = L 1 (nK 1 ).) Hence, in this particular case of Theorem 6, the existence of an appropriate k 1 k −1 is required. By Observation 3, this is equivalent to the claim that G is the (k − 1)-line graph of a K k -free graph. Thus, we obtain: Corollary 7. For every two integers n 2 and k 2, the product G K n is a k-line graph if and only if G is the (k − 1)-line graph of a K k -free graph.
Theorem 6 will be proved at the end of this section. First we need some lemmas.
) \ C is either adjacent to none of the vertices of C or c is adjacent to exactly two vertices of C.
(ii) Assume that k 2 and no component of the Proof. First, assume that H contains a K k+1 , which is induced by the vertex set , and consider the corresponding (k + 1)-clique C in L k (H) whose vertices c 1 , . . . , c k+1 represent the k-subsets of V . If there is a further vertex c * adjacent to at least one vertex of C, then in H the k-clique C * , which is the preimage of c * , intersects V in exactly k − 1 vertices. Without loss of generality, we assume that for every c i the preimage is Therefore, c * is adjacent to exactly two vertices of C. This verifies (i). Concerning (ii), note that if the (k + 1)-clique C is not a component of L k (H) then such a c * surely exists, and if k 2, vertices c 1 , c k , c k+1 , c * induce a diamond in L k (H).
For the other direction of (ii), assume that H is K k+1 -free, and in L k (H) vertices c 1 , c 2 , c 3 , c 4 induce a diamond where c 2 and c 4 are nonadjacent. By Observation 2, the preimages C 1 , C 2 , C 3 of c 1 , c 2 , c 3 are three different k-cliques of H sharing a fixed (k − 1)clique. Then, |C 1 ∩ C 2 ∩ C 3 | = k − 1 and similarly, |C 1 ∩ C 3 ∩ C 4 | = k − 1 hold. By the adjacency of c 1 and c 3 , |C 1 ∩ C 3 | = k − 1 is valid as well. Hence, the vertex sets C 1 ∩ C 2 ∩ C 3 and C 1 ∩ C 3 ∩ C 4 must be the same, contradicting the non-adjacency of c 2 and c 4 . Thus, we conclude that for a K k+1 -free H, the k-line graph contains no induced diamond.
Lemma 9. If the Cartesian product G F of two non-edgeless graphs is the k-line graph of H, then H is K k+1 -free.
Proof. Suppose for a contradiction that H contains a complete subgraph X induced by vertices x 1 , . . . , x k+1 . Then, in L k (H) = G F the vertices c 1 , . . . , c k+1 , representing the k-cliques C 1 , . . . , C k+1 ⊂ X, form a complete subgraph. Hence, all these vertices the electronic journal of combinatorics 22 (3) (2015), #P3.33 c 1 , . . . , c k+1 must belong either to the same copy of G or to the same copy of F . Assume without loss of generality that c i = (v 1 , u i ) for every 1 i k +1, and let v j be a neighbor of v 1 in G. Then, the vertex (v j , u 1 ) is adjacent to only one vertex (namely, to (v 1 , u 1 )) from the (k + 1)-clique. This contradicts Lemma 8(i) and hence, H is K k+1 -free.
Proof. As the 1-line graph L 1 (H) is a complete graph, it contains no induced four-cycle. Hence, we can assume that k 2.
We observe that v 1 = z 1 and v 2 = z 2 , as any v i = z i would mean the adjacency of c 2 and c 4 . Now, suppose for a contradiction that v 2 / ∈ C 3 . Since c 1 c 2 and c 2 c 3 are edges in G and v 2 ∈ C 2 , but v 2 / ∈ C 1 and v 2 ∈ C 3 , it follows that, In view of Lemma 10, we can give a structural characterization for graphs whose kline graph is the Cartesian product G F of two non-edgeless graphs. We will use the following notions.
If L k (H) = G F , consider a copy G i and the k-cliques of H which are represented by the vertices of G i . A vertex contained in all these k-cliques is called a universal vertex, otherwise it is non-universal (with respect to G i ). Formally, let Analogously, the sets U F i and X F i of universal and non-universal vertices with respect to the copy F i are also introduced.
Lemma 11. Let G and F be two connected graphs and let L k (H) = G F .
(i) For every two copies G i and G j of G the non-universal vertices are the same: Proof. First assume that u i and u j are adjacent vertices in F . For every two vertices v a and v b of G there is a path between (v a , u i ) and (v b , u i ) in G i . This path together with the corresponding vertices of G j induces a chain of 4-cycles. Hence, the repeated application of Lemma 10 implies that for every two vertices v a and v b of G. As follows, there are fixed vertices w i,j ∈ U G i (H) and w j,i ∈ U G j (H) such that the preimage of any vertex of copy G j can be obtained from the electronic journal of combinatorics 22 (3) (2015), #P3.33 the preimage of the corresponding vertex of copy G i by replacing w i,j with w j,i in the k-clique. Thus, Since F is connected, the latter equality is valid for nonadjacent vertices u i , u j ∈ V (F ) as well. This verifies (i).
To prove (ii), observe that Proof of Theorem 6. To prove sufficiency, let G = L k 1 (G ) and -free, and k 1 + k 2 k. Then, the join H = G ∨ F is K k 1 +k 2 +1 -free and every (k 1 + k 2 )-clique of H originates from a k 1 -clique of G and from a k 2 -clique of F . Thus, the vertices of L k 1 +k 2 (H ) correspond to the pairs (v i , u j ) with v i ∈ V (G) and u j ∈ V (F ). Moreover two vertices (v i , u j ) and (v k , u ) in L k 1 +k 2 (H ) are adjacent if and only if • either v i = v k and the k 2 -cliques C(u j ) and C(u ) share a (k 2 − 1)-clique in F , that is u j u ∈ E(F ), • or u j = u and the k 1 -cliques C(v i ) and Therefore, L k 1 +k 2 (H ) = G F , and by Observation 3, To prove necessity, suppose that H = G F is the k-line graph of H . By Lemma 9, H is K k+1 -free. Consider the sets A = U G 1 (H ) and B = U F 1 (H ) of universal vertices in copies G 1 and F 1 .
Claim A. G is the (k − |A|)-line graph of a K k−|A|+1 -free graph and F is the (k − |B|)-line graph of a K k−|B|+1 -free graph.
Proof. By Lemma 11(ii), G 1 ∼ = G is the k-line graph of the subgraph G * ⊂ H induced by A ∪ X G 1 (H ). If the universal vertices of G * are deleted, we obtain G = G * − A. While constructing G from G * , every k-clique is shrunk into a (k − |A|)-clique and two cliques share exactly k − |A| − 1 vertices if and only if the corresponding vertices of G are adjacent. This proves that G = L k−|A| (G ). It is clear that G is K k−|A|+1 -free. The analogous argument for F yields Proof. Assume to the contrary that |A| + |B| < k. Then, there exists a vertex z ∈ C(v 1 , u 1 ) \ (A ∪ B). As the graph G 1 ∼ = G is connected and z cannot be contained in all preimages C(v , u 1 ), there exist adjacent vertices (v i , u 1 ) and (v j , u 1 ) such that z ∈ C(v i , u 1 ) and z / ∈ C(v j , u 1 ). This means C(v i , u 1 ) \ C(v j , u 1 ) = {z}. Similarly for 10, for the 4-cycle induced by {(v i , u n ), (v i , u m ), (v j , u m ), (v j , u n )} the following equalities hold: They give a contradiction on the question whether z is in C(v i , u n ) or not. This proves |A| + |B| k.
Denoting k 1 = k − |A| and k 2 = k − |B|, k 1 + k 2 k follows by Claim B. Then, Claim A proves the necessity of the condition given for G and F in the theorem.
The proof of Theorem 6 also verifies the following statement.

NP-completeness of recognizing triangle graphs
As is well-known, the line graphs can be recognized in polynomial time due to the forbidden subgraph characterization by Beineke [6]. Also linear-time algorithms were designed for solving this problem [14,17]. Here we prove that triangle graphs (that is, 3-line graphs) are hard to recognize.
Theorem 13. The following problems are NP-complete: (i) Recognizing triangle graphs.
(ii) Deciding whether a given graph is the triangle graph of a K 4 -free graph.
Moreover, both problems remain NP-complete on the class of connected graphs.
Before proving Theorem 13, we verify two lemmas which give necessary conditions for graphs to be anti-Gallai or triangle graphs of some K 4 -free graph, respectively.

Lemma 14.
Assume that F is a connected non-trivial graph and F is the anti-Gallai graph of F . Then F is K 4 -free if and only if every edge of F is contained in exactly one triangle, or equivalently ( ) every maximal clique of F is a triangle and any two triangles share at most one vertex.
Proof. If F contains a K 4 subgraph then F = (F ) contains an induced K 6 − 3K 2 and ( ) does not hold. If F is K 4 -free, any three pairwise adjacent vertices in (F ) correspond to three edges of F which form a triangle. Hence no edge of (F ) belongs to more than one triangle. Additionally, by definition, in an anti-Gallai graph every edge corresponds to two preimage-edges of a triangle; hence, every edge of (F ) is contained in a K 3 . Since F is assumed to be connected and non-edgeless, it contains no isolated vertices. This proves that every maximal clique of F is a K 3 and any two triangles have at most one vertex in common. Lemma 15. Assume that G is a connected graph which is not isomorphic to K 4 , moreover G = T (G ). Then G is K 4 -free if and only if ( ) each vertex of G is contained in at most three maximal cliques and these cliques are pairwise edge-disjoint.
Proof. In this proof, the vertex of G whose preimage is a triangle abc in G will be denoted by t abc . First suppose that G contains a K 4 induced by the vertices x, y, z, u. Clearly, the four triangles of the K 4 correspond to a 4-clique in T (G ). By our condition T (G ) is not a 4-clique, hence there exists a triangle in G , containing exactly two vertices from x, y, z, u. Say, this triangle is xyw. In T (G ), the vertex originated from xyz is contained in both cliques induced by the vertex sets {t xyz , t xyu , t yzu , t xzu } and {t xyz , t xyu , t xyw }, respectively. Maybe the second clique is not maximal, but since there is no edge between t yzu and t xyw , there are two different maximal cliques with the common edge t xyz t xyu . This shows that ( ) does not hold.
For the converse, suppose that G is K 4 -free. Then by Observation 2, each clique of T (G ) corresponds to triangles sharing a fixed edge in G . Thus, a vertex t xyz ∈ V (T (G)) can be contained only in those maximal cliques which correspond to the three edges of its preimage-triangle (one or two of these cliques might be missing) and any two of these maximal cliques have t xyz as the only common vertex, hence ( ) holds.
While proving that the recognition problem of triangle graphs is NP-complete, we will use the following notion. The triangle-restriction of a graph is obtained if the edges not contained in any triangles and the possibly arising isolated vertices are deleted. Every graph has a triangle-restriction, and the application of this operator changes neither the anti-Gallai graph (if it is connected) 1 , nor the triangle graph. A graph is called trianglerestricted if each edge and each vertex of it belongs to a triangle. The clique graph K(G) of a graph G is the intersection graph of the set of all maximal cliques of G. 2 Proof of Theorem 13. The decision problems are clearly in NP. The NP-completeness of (ii) will be reduced from the following theorem recently proved by Anand et al. [2]: Deciding whether a connected graph F is the anti-Gallai graph of some K 4 -free graph is an NP-complete problem.
Consider an instance F to decide whether it is the anti-Gallai graph of a K 4 -free graph. In the first step, we check the necessary condition ( ); if it does not hold, F is not the anti-Gallai graph of any K 4 -free graphs. From now on, suppose that ( ) holds for F . Then every maximal clique of F is a triangle and the clique graph G = K(F ) is exactly the triangle-intersection graph of F . If F is connected then so is G, and G ∼ = K 4 holds if and only if F is the union of four triangles sharing exactly one vertex. Hence, from now on we assume that G ∼ = K 4 . In addition, if F fulfills property ( ), then its triangle-intersection graph G fulfills property ( ).
Next, we prove that F is the anti-Gallai graph of a K 4 -free triangle-restricted graph H if and only if G is the triangle graph of H.
Assume that F = (F ). By ( ), F is K 4 -free, hence its triangles are in one-to-one correspondence with the triangles of F and by ( ) this yields a one-to-one correspondence with the vertices of G. Moreover two triangles in F share an edge if and only if the corresponding triangles share a vertex in F ; and if and only if the corresponding vertices in the clique graph G are adjacent. Therefore, G = T (F ).
To prove the other direction, assume that G = T (G ). Since G satisfies ( ), G must be K 4 -free. We can choose G to be triangle-restricted. Now, for every vertex t ∈ V (G), if t is contained in only two maximal cliques, then in addition the 1-element vertex set {t} will also be considered as a 'maximal clique' of G. Similarly, if t is contained in only one clique of G, then {t} is also taken as a 'maximal clique' with multiplicity 2. Then the edges of G are in one-to-one correspondence with the maximal cliques of G. These maximal cliques are in one-to-one correspondence with the vertices of F , where the one-element cliques of G represent vertices contained in only one triangle of F . Also, two edges of G belong to a common triangle if and only if the corresponding maximal cliques have a common vertex (which represents the triangle); that is, if and only if the two vertices of F , represented by the cliques, are adjacent. This proves F = (G ).
Checking ( ) and constructing G from F takes polynomial time. So, the recognition problem of the anti-Gallai graphs can be reduced to that of the triangle graphs in polynomial time. Hence, the recognition problem of triangle graphs is NP-complete and this remains valid on the class of connected graphs satisfying ( ).

Recognizing generalized line graphs and anti-Gallai graphs
In this section we turn to the recognition problems of general k-line graphs and k-anti-Gallai graphs. In sharp contrast to the linear-time recognizability of k-line graphs for k 2, by Theorem 13 the analogous problem is NP-complete for k = 3. Also, anti-Gallai graphs are hard to recognize as proved by Anand et al. via a reduction from 3-SAT [2]. Now, we complete these results by proving that the recognition problems of k-line graphs and k-anti-Gallai graphs are NP-complete for each k 3.
Theorem 16. The following problems are NP-complete for every fixed k 3: (i) Recognizing k-line graphs.
(ii) Deciding whether a given graph is the k-line graph of a K k+1 -free graph.
Moreover both problems remain NP-complete on the class of connected graphs.
Proof. Clearly, problems (i) and (ii) are in NP. Moreover, by Theorem 13, both problems are NP-complete for k = 3, already on the class of connected graphs. Therefore, we can proceed by induction on k. For the inductive step, assume that k 4 and that (ii) is NP-complete for k − 1 on the class of connected graphs. Let G be a connected graph and construct the Cartesian product H = G K 2 , which is also connected. Due to Corollary 7, G is a (k − 1)-line graph of a K k -free graph if and only if H is a k-line graph of a K k+1 -free graph. Therefore, (ii) is NP-complete for every k 3. On the other hand, by Lemma 9 a graph of the form G K 2 is a k-line graph if and only if it is a k-line graph of a K k+1 -free graph. Hence, the above reduction also proves the NP-completeness of (i) for every k 3.
Before proving the same hardness for the recognition problem of k-anti-Gallai graphs, we state a lemma. Note that part (i) gives the same condition (namely diamond-freeness) for k (G) as Lemma 8 does for L k+1 (G) to ensure that G is K k+2 -free.
Lemma 17. For every k 2, every graph G and its k-anti-Gallai graph k (G) satisfy the following relations: (ii) G is K k+2 -free if and only if each maximal clique of k (G) is either an isolated vertex or a (k + 1)-clique. Moreover any two maximal cliques intersect in at most one vertex.
Proof. First, assume that G contains a (k + 2)-clique induced by the vertex set V = {v 1 , . . . , v k+2 }. Consider the following k-cliques: Any two of these k-cliques are in a common (k + 1)-clique except the pair (C 2 , C 4 ). Therefore, in the k-anti-Gallai graph the corresponding vertices c 1 , c 2 , c 3 and c 4 induce a diamond. In addition, the two maximal cliques containing c 1 c 2 c 3 and c 1 c 3 c 4 , respectively, must be different and intersect in more than one vertex.
To prove the other direction of (i) and (ii), assume that G is K k+2 -free. First, consider an edge c i c j ∈ E( k (G)). The union C i ∪ C j of the represented k-cliques induces a K k+1 subgraph in G, whose k-clique subgraphs are represented by vertices forming a K k+1 subgraph in k (G). Hence, every edge of k (G) belongs to a (k + 1)-clique. Now, suppose that c i c j c is a triangle in k (G). The union C i ∪ C j of the preimage cliques induces a K k+1 in G. Also C i ∪ C j ∪ C induces a complete subgraph as every two of its vertices are contained in a common clique. Since G is K k+2 -free, C i ∪ C j ∪ C is a (k + 1)-clique as well, and C ⊂ C i ∪ C j must hold. This implies that in the k-anti-Gallai graph, every two adjacent vertices c i , c j together with all their common neighbors form a (k + 1)-clique. As follows concerning (i), k (G) contains no induced diamond. Furthermore, each edge belongs to exactly one maximal clique of k (G) and this must be a (k + 1)-clique. These complete the proof of (i) and (ii). (ii) Recognizing k-anti-Gallai graphs on the class of connected and diamond-free graphs.
(iii) Deciding whether a given connected graph is a k-anti-Gallai graph of a K k+2 -free graph.
Proof. The membership in NP is obvious for each of (i)-(iii). As diamond-freeness can be checked in polynomial time, statements (ii) and (iii) imply each other by Lemma 17(i). It is also clear that (ii) implies (i). Then, it is enough to prove (iii). For k = 2, problem (iii) was proved to be NP-complete in [2]. We proceed by induction on k. Consider a generic connected instance G and an integer k 3.
For each fixed k, the condition given in Lemma 17(ii) can be checked in polynomial time. If it does not hold, G cannot be a k-anti-Gallai graph of any K k+2 -free graph. From now on we suppose that every maximal clique of G is of order k + 1 and any two maximal cliques have at most one vertex in common. For such a G we construct the following graph G e and prove that G is a k-anti-Gallai graph if and only if G e is a (k + 1)-anti-Gallai graph.
Construction of G e . Take two disjoint copies G 1 and G 2 of G with vertex sets V (G j ) = {c j i : c i ∈ V (G)} (j = 1, 2), moreover one vertex b s for each (k + 1)-clique B s of G. Besides the edges of G 1 and G 2 take all edges of the form b s c j i for which c i ∈ B s and j = 1, 2 hold. As G consists of (k + 1)-cliques such that any two of them intersect in at most one vertex, G e consists of (k + 2)-cliques such that any two of them intersect in at most one vertex.
Proof. Let B denote the set of k-cliques of G . Corresponding to the relation G = k (G ), we have a bijection φ : B → V (G) such that every k-clique of G is mapped to the vertex representing it in k (G ).
Partition the set A of (k + 1)-cliques of the join G e = G ∨ {z 1 , z 2 } into three subsets. An A ∈ A is said to be of Type 1 or 2 or 3 if it contains z 1 , or z 2 , or none of them, respectively. (Since z 1 and z 2 are nonadjacent, no clique contains both of them.) Now, define a bijection ϕ : A → V (G e ) as follows. For every A ∈ A, To prove Claim C, we show that two (k + 1)-cliques A 1 and A 2 of G e are contained in a common K k+2 if and only if ϕ(A 1 ) and ϕ(A 2 ) are adjacent in G e .
• Type-1 cliques are mapped onto V (G 1 ). In addition, two cliques  • Since z 1 and z 2 are nonadjacent, no two cliques, one of Type 1 and the other of Type 2, belong to a common K k+2 in G e . Correspondingly, by the construction, there is no edge between V (G 1 ) and V (G 2 ) in G e . Finally, as G is K k+2 -free, no two (k +1)-cliques of Type 3 are in a common (k +2)-clique in G e . This corresponds to the fact that V (G e ) \ (V (G 1 ) ∪ V (G 2 )) is an independent vertex set.
These observations prove that G e = k+1 (G e ).
Concerning the following claim, let us recall that Construction of G e is applied for a (K k+2 , diamond)-free graph G, and yields a (K k+3 , diamond)-free G e .
Proof. By Lemma 17, F must be K k+3 -free. Consider a (k + 2)-clique D of G e . This contains exactly one vertex from V (G e ) \ (V (G 1 ) ∪ V (G 2 )), say b , and assume that the other vertices of D are from V (G 1 ). The preimages of the vertices of D are exactly the (k + 1)-clique subgraphs of a (k + 2)-clique A of F . There is a unique vertex u , called complementing vertex of D , such that u ∈ A . Moreover it is not contained in the preimage C(b ) but is contained in the preimage of each further vertex of D . For this vertex, Assume for a contradiction that there exist two different complementing vertices for the (k + 2)-cliques meeting V (G 1 ). By the connectivity of G 1 , there exist two (k + 2)cliques, say D 1 and D 2 , intersecting in a vertex c 1 i with complementing vertices u 1 = u 2 . Then, consider the vertices b 1 ∈ D 1 , b 2 ∈ D 2 , the induced 4-cycle c 1 i b 1 c 2 i b 2 in G e and the preimage (k + 1)-cliques , there exist vertices x and y in F such that By our assumption, u 1 = u 2 . Moreover, x = y must be valid, since x = y would imply for B 1 ∪ B 2 = C 1 i ∪ {x} to be a (k + 2)-clique, contradicting b 1 b 2 / ∈ E(G e ). Further, if any two vertices coincide from the remaining pairs of u 1 , u 2 , x, y, it would contradict the above definition of x and y. Hence, u 1 , u 2 , x, y are four different vertices and the Observe that the vertices in M ∪ {u 1 , u 2 , x, y} are pairwise adjacent as contained together in at least one of the (k + 2)-cliques C 1 i ∪ B 1 and C 1 i ∪ B 2 , the only exception is the pair x, y. They are surely nonadjacent, as otherwise M ∪ {u 1 , u 2 , x, y} would be a forbidden (k + 3)-clique in F .
Next, consider the k-element intersections of the choices (x, u 1 ) or (u 2 , y) would imply that C 1 i ∪ C 2 i is a (k + 2)-clique, contradicting c 1 i c 2 i / ∈ E(G e ); and finally, the choice (x, y) contradicts the non-adjacency of x and y. By this contradiction we conclude that all (k + 2)-cliques intersecting G 1 have the same complementing vertex, say z 1 , and the similar result for G 2 with the common complementing vertex z 2 also follows. Deleting these vertices from F , we obtain the graph F for which k (F ) = G holds.
Via Claims C and D, we have proved that G is the k-anti-Gallai graph of some K k+2free graph if and only if G e is the (k + 1)-anti-Gallai graph of some K k+3 -free graph. We conclude that if problem (iii) is NP-complete for an integer k 2, the same hardness follows for k + 1. Moreover, the reduction takes time polynomial in terms of |V (G)| and k. This proves (iii) from which (i) and (ii) directly follow.
6 Graphs with isomorphic line graph and k-line graph Lemma 19. If K n is a subgraph of L k (G) for n k + 2, then the k-cliques in G corresponding to these n vertices in L k (G) share k − 1 vertices.
Proof. By Observation 2, the vertices of K n either correspond to n k-cliques of G contained in a common K k+1 , or correspond to n k-cliques sharing a fixed (k − 1)-clique. The former case is impossible if n k + 2. Hence, the statement follows.
Theorem 20. Let G be a connected graph. Then, for any k 3, L k (G) ∼ = L(G) holds if and only if G = K k+2 .
Proof. We begin with the remark that K k+2 indeed satisfies L k (K k+2 ) ∼ = L(K k+2 ). Isomorphism can be established by the vertex-complementarity of edges (2-cliques) and k-cliques. Two edges of K k+2 share a vertex (and hence are adjacent in L(K k+2 )) if and only if their complementing k-tuples (k-cliques) share exactly k − 1 vertices (and hence are adjacent in L k (K k+2 )).
The rest of the proof is devoted to the "only if" part. Let G be a connected graph such that L k (G) ∼ = L(G). Let t = ω(L k (G)) = ω(L(G)). If t k + 2, then by Lemma 19, the k-cliques in G corresponding to the t vertices in L k (G) that induce a t-clique, share k − 1 vertices. Therefore, ∆(G) k − 2 + t and hence ω(L(G)) k − 2 + t > t for k 3, which contradicts ω(L(G)) = t.
Therefore, t k + 1, which means ω(L(G)) k + 1. Thus ∆(G) k + 1, from which ω(G) k + 2 clearly follows. Moreover, since, L k (G) is not the null graph, ω(G) k also holds. Hence, we have k ω(G) k + 2. In the rest of the proof we consider the three possible values of ω.
We saw earlier that a 4-clique in L k (G) would require in G either a (k + 1)-clique or a (k − 1)-clique with four external neighbors. Hence in the current situation with ∆(G) k + 1 and ω(G) = k we must have ω(L k (G)) 3, which also means ω(L(G)) 3 the electronic journal of combinatorics 22(3) (2015), #P3.33 and therefore G has ∆(G) 3. Then ω(G) 4, that is k = 3 or 4. We show that these cases cannot occur.
Since ∆(G) k+1, G contains no (k−1)-clique with k+1 common external neighbors. Hence, L k (G) also has only one K k+1 . Therefore, L(G) also contains only one K k+1 and hence G has only one vertex of degree k + 1. It means that only one vertex of K k+1 in G has a neighbor outside the K k+1 , so that L k (G) = L k (K k+1 ) = K k+1 (for G is connected, L(G) is connected and hence L k (G) is connected). But, L(G) = K k+1 . Therefore, G must contain more than one K k+1 .
Subcase B: G contains two K k+1 subgraphs which share l > 0 vertices In this case, ∆(G) 2k − l + 1. By ∆(G) k + 1 we see that l = k, therefore K k+2 − e ⊆ G. Since L k (G) is connected and k vertices in K k+2 − e already attained the maximum possible degree k + 1, L k (G) = L k (K k+2 − e) must hold. But then the number of vertices in L k (G) is strictly less than the number of vertices in L(G), which is a contradiction.
Subcase C: G contains a K k+1 which does not share vertices with any other K k+1 Either this reduces to subcase A or, by connectivity, k − 1 vertices of this K k+1 belong to a k-clique outside this K k+1 . In that case, these k − 1 vertices cannot have any further neighbors (since they attained the maximum degree k + 1) and there are only two more vertices in the K k+1 under consideration. If k > 3 then, since L k (G) is connected, there are no further k-cliques in G and hence L k (G) is K k+1 together with a vertex having exactly two neighbors in K k+1 , which is obviously not isomorphic to L(G). If k = 3, using the same arguments, we can see that L k (G) is a K 4 with one or two further vertices having exactly two neighbors in K 4 . In either case, L k (G) = L(G). In this case ∆(G) k + 1 together with connectivity implies G = K k+2 , and this is exactly what had to be proven.

Concluding remarks
Concerning the algorithmic complexity of recognizing k-line graphs, the problem is trivial for k = 1, solvable in linear-time for k = 2, and as we have proved, it becomes NPcomplete for each k 3. It is worth noting that there is a further jump between the behavior of 2-and 3-line graphs, which likely is in connection with the jump occurring in time complexity. Namely, this further difference is in the uniqueness of preimages. As a matter of fact, each connected line graph different from K 3 has a unique preimage if we disregard isolated vertices. In other words, viewing the situation from the side of preimages, the line graphs of two non-isomorphic graphs containing no isolated vertices and no K 3 -components surely are non-isomorphic. The similar statement is not true for triangle graphs, even if we suppose that every edge of the preimage is contained in a triangle. For example, there are seven essentially different graphs whose triangle graph is the 8-cycle (see Figure 3). Additionally, the number of non-isomorphic pre-images of an n-cycle goes to infinity as n → ∞ [3].  Figure 3: The seven triangle restricted graphs whose triangle graph is C 8 .
Finally, we make some remarks on an open problem closely related to the results of this paper.
For an integer k 1, the vertices of the k-Gallai graph Γ k (G) represent the k-cliques of G, moreover its two vertices are adjacent if and only if the corresponding k-cliques of G share a (k − 1)-clique but they are not contained in a common (k + 1)-clique. By this definition, the 1-Gallai graph Γ 1 (G) is exactly the complement G of G, whilst 2-Gallai graph means Gallai graph in the usual sense, as introduced by Gallai in [11]. Obviously, Γ k (G) ⊆ L k (G) holds. Moreover k (G) and Γ k (G) together determine an edge partition of the k-line graph. Our theorems together with the earlier results from [6] and [2] determine the time complexity of recognition problems of the k-line graphs and the k-anti-Gallai graphs for each fixed k 1. Since G = Γ 1 (G), every graph is a 1-Gallai graph. But for each k 2 this recognition problem remains open.