Fast Exact Algorithm for L (2 , 1)-Labeling of Graphs (cid:63)

. An L (2 , 1)-labeling of a graph is a mapping from its vertex set into nonnegative integers such that the labels assigned to adjacent vertices diﬀer by at least 2, and labels assigned to vertices of distance 2 are diﬀerent. The span of such a labeling is the maximum label used, and the L (2 , 1)-span of a graph is the minimum possible span of its L (2 , 1)- labelings. We show how to compute the L (2 , 1)-span of a connected graph in time O ∗ (2 . 6488 n ). Previously published exact exponential time algorithms were gradually improving the base of the exponential function from 4 to the so far best known 3.2361, with 3 seemingly having been the Holy Grail.


Introduction
An L(2, 1)-labeling of a graph is a mapping from its vertex set into nonnegative integers such that the labels assigned to adjacent vertices differ by at least 2, and labels assigned to vertices of distance 2 are different.The span of such a labeling is the maximum label used and the minimum possible span of an L(2, 1)-labeling of a graph G is denoted by λ(G).This variant of graph coloring is recently receiving considerable attention (see [3,7,10,24] for some surveys on the problem and its generalizations).It is motivated by the Frequency Assignment Problem whose task is to assign frequencies to transmitters in a broadcasting network while avoiding undesired interference.In the L(2, 1)-labeling model the vertices of the input graph correspond to transmitters of the network and the edges indicate which pairs of transmitters are too close to each other so that interference could occur even if the broadcasting channels were just one apart.The second condition follows from a requirement that no transmitter should have two or more close neighbors transmitting on the same frequency.
The concept of distance constrained graph labeling was introduced by Hale [12] and, according to [11], Roberts [21] was the first one who suggested to investigate the L(2, 1) case in particular.In their seminal paper [11], Griggs and Yeh present first complexity results and several inspiring conjectures.Their conjecture that λ(G) ≤ ∆(G) 2 initiated intensive research and is still not fully resolved.It is known to be true for many special graph classes and quite recently has been proved for graphs of large maximum degree [14].Yet it is interesting to note that the Petersen and Hoffmann-Singleton graphs are the only two known graphs that satisfy equality in this bound (for maximum degree greater than 2).
From the complexity point of view, Griggs and Yeh showed that determining λ(G) is NP-hard and raised the question of computational complexity of determining λ(G) for trees.The latter was answered by Chang and Kuo by providing a polynomial time algorithm in [4].This has been later improved to a linear time algorithm by Hasunuma et al. in [13].For general graphs, Fiala et al. [6] proved that deciding λ(G) ≤ k remains NP-complete for every fixed k ≥ 4, Bodlaender et al. [2] proved NP-completeness for planar inputs for k = 8, and Janczewski et al. [16] proved NP-completeness for planar inputs and k = 4.The fact that distance constrained labeling is a more difficult task than ordinary coloring is probably most strikingly documented by the NP-completeness of deciding λ(G) ≤ k for series-parallel graphs [5] (here of course k is part of the input).
Recent trend in algorithmic research is designing exact exponential time algorithms for NP-hard problems while trying to minimize the constant which is the base of the exponential running time function.Kratochvíl et al. [20] gave an O * (1.3161 n )1 algorithm for L(2, 1)-labeling of span 4 (and this algorithm was referenced as one of the examples of the Measure and Conquer branching technique in [9]).A dynamic programming approach can be used to determining the L(2, 1)-span (or, in other words, to decide λ(G) ≤ k even when k is part of the input).The development in this area has been quite interesting.An exact algorithm for the so called Channel Assignment Problem of Král' [19] implies an O * (4 n ) algorithm for the L(2, 1)-labeling problem.This has been improved by Havet et al. [15] to an O * (3.8739 n ) algorithm by proving and using a bound on the number of 2-packings in a connected graph.That paper concludes with a conjecture on partitioning graphs into stars which would imply a better running time for the L(2, 1)-labeling problem when the minimum degree of the input graph is high.This conjecture was later proved by Alon and Wormald [1], how-ever, even for arbitrarily large minimum degree the running time is not better than O * (3 n ).In the meantime, Junosza-Szaniawski and Rzażewski [17,18] modified the algorithm and refined the running time analysis and proved that their algorithm runs in time O * (3.2361 n ).A lower-bound of Ω(3.0731 n ) on the worstcase running-time of their algorithm is also provided.The magic running time of O * (3 n ) still seemed hardly attainable.In this paper we provide a breakthrough in this question by proving the following theorem.
Theorem 1.The L(2, 1)-span of a connected graph can be determined in time O * (2.6488 n ).
Our algorithm is based on a reduction of the number of operations performed in the recursive step of the dynamic programming algorithm, which is in essence similar to Strassen's algorithm for matrix multiplication [23].This trick itself achieves running time O * (3 n ).Further improvement is obtained by proving in Section 2 an upper bound on the number of pairs of disjoint subset of the vertex set, where one of the sets is a 2-packing.We believe that this bound and the technique which is used for obtaining it are of interest on their own.

Auxiliary Combinatorial Results
Throughout the paper we consider finite undirected graphs without multiple edges or loops.The vertex set (edge set) of a graph G is denoted by and its closed neighborhood is denoted by N G [X] = N G (X) ∪ X.For a subset X ⊆ V (G) we denote the subgraph of G induced by the vertices in X by G[X].The symbol n is reserved for the number of vertices of the input graph, which will always be denoted by G.The distance dist G (x, y) between two vertices u and v in a graph G is the length of a shortest path joining v and v.
A subset S of the vertex set of G is called a 2-packing if the distance of any two distinct vertices of S is at least 3 (i.e., S is an independent set and no two vertices of S have a common neighbor in G).A pair (S, X) of subsets of V (G) is called a proper pair if S ∩ X = ∅ and S is a 2-packing in G.The number of proper pairs in G will be denoted by pp(G) and by the definition, we have where the maximum is taken over all connected graphs H with n vertices.
Theorem 2. The value of pp(n) is upper-bounded by O(2.6488 n ).
Proof.Let G = (V, E) be a connected graph on n vertices such that pp(G) = pp(n).We observe that if S is a 2-packing of G, then for any edge e of G, the set S is also a 2-packing of G = (V, E \ {e}).Thus removing an edge does not decrease the number of proper pairs and we can remove edges from the graph as long as it stays connected.Hence without loss of generality, we assume that G is a tree.
( * ) Suppose in G there are two leaves v 1 and v 2 , which have a common neighbor v 3 .Notice that every proper pair in G is proper in the graph H obtained from G by removing the edge v 1 v 3 and adding the edge v 1 v 2 (see Figure 1).Since this operation does not reduce the number of proper pairs, we can assume that there are no two or more leaves with a common neighbor in G.It is easy to observe that pp(0) = 1, pp(1) = 3 and pp(2) = 8.Assume that |V (G)| ≥ 3 and let P be a longest path in G. Let v be an end-vertex of the path P , u its neighbor on P , and c a neighbor of u on P other that v (the third vertex on P ).By the observation ( * ) we can assume that deg(u) = 2.
(A) If deg(c) ≤ 2, we can partition all proper pairs (S, X) to two subsets: those in which v / ∈ S and those in which v ∈ S (see Figure 2).Notice that if v / ∈ S, then v can be in X or outside S ∪ X.If v ∈ S, then none of the vertices {u, c} can belong to S. Each of them can be in X or outside S ∪ X.Since the graphs G − v and G − {v, u, c} are connected, we obtain the following recursion:   Let W = {w 1 , . . ., w q } = {w ∈ V (G) : w is a leaf in G and dist G (w, c) = 2} and U = N (W ) in the case (B0) and U = N (W ) ∪ {x} in the case (B1).We can partition the set of proper pairs (S, X) to whose in which S ∩ (W ∪ U ) = ∅ and the others.
Each of the vertices in (W ∪ U ∪ {c}) \ S can be in X or outside S ∪ X.
Since the graphs G − (W ∪ U ) and G − (W ∪ U ∪ {c}) are connected, we obtain the following recursions: We shall prove by induction on n that for n ≥ 0 the following holds: where τ = 2.6487.. is the positive root of the equation τ 5 = 16τ + 88.
It is easy to observe that the inequality (4) holds for n ≤ 2. Now assume that the inequality holds for all values smaller than n.
x−1 is decreasing for all real x > 2 and h 0 (2) = 1. Hence x−1 is decreasing for all real x > 1 and h 1 (1) < 1, we obtain: We have shown that regardless of the structure of G, the function 2 • τ n is an upper bound on the number of proper pairs in G. Hence pp(n One is inclined to conjecture that the worst case is attained in the case of a path P n on n vertices.A simple calculation shows that pp(P n ) = Θ(2.5943.. n ).
The following example shows that intuition fails in this case.Considering separately the number of proper pairs (S, X), in which S contains and does not contain marked vertices, we obtain the following system of recursions: Solving this system we obtain the result a k = Θ(x k ), where x = 17.8149.. is the positive solution of the equation x 3 = 16x 2 + 576.Since k = n/3, the graph A k contains a k = Θ(17.8149.. n/3 ) = Θ(2.6117.. n ) proper pairs.The main tool in [15] was partitioning a connected input graph into stars of orders at least 2. Our approach is to divide the computation into connected subgraphs of large constant order.The star graph is an example showing that one cannot always find such a partition.However, we can find a covering with a small overlap of the connected subgraphs, as shown by the following result.
Theorem 4. Let G be a connected graph of order n and let k < n be a positive integer.Then there exist connected subgraphs G 1 , G 2 , . . ., G q of G such that (i) every vertex of G belongs to at least one of them, (ii) the order of each of G 1 , G 2 , . . ., G q−1 is at least k and at most 2k (while for G q we only require |V (G q )| ≤ 2k), and (iii) the sum of the numbers of vertices of G i s is at most n(1 + 1 k ).Proof.Assume G is rooted in an arbitrary vertex r and consider a DFS-tree T of G.For every vertex v let T (v) be the subtree rooted in v.If |T (r)| ≤ 2k then add G to the set of desired subgraphs and finish.If there is a vertex v such that k ≤ |T (v)| ≤ 2k then add G[V (T (v))] to the set of desired subgraphs and proceed recursively with G \ V (T (v)).Otherwise there must be a vertex v such that |T (v)| > 2k and for its every child u, |T (u)| < k.In such a case find a subset {u 1 , ..
] to the set of desired subgraphs and proceed with the graph G \ (V (T (u 1 )) ∪ .. ∪ V (T (u i ))).This procedure terminates after at most n k steps and in each of them we have left at most one vertex of the identified connected subgraph in the further processed graph.

Exact Algorithm for L(2, 1)-labeling
One key ingredient in our algorithm are algebraic manipulations very similar to fast matrix multiplication: If we have 2 k × 2 k -matrices A and B we can divide them each into four block matrices of the same size.We can then compute AB very easily by eight matrix multiplications of 2 k−1 × 2 k−1 -matrices.Doing so recursively leads again to a running time of O(n 3 ) -just as the naive algorithm itself.It is, however, possible to improve on the running time by using only seven matrix multiplications to achieve the same result [23].It turns out that this technique alone does not work in our case, though.We have to use one other trick: We jump between two representations of partial L(2, 1)-labelings in the course of our dynamic programming algorithm.The idea to use different representations of the same data in dynamic programming is not new and was used in a similar way before [22].
We define the partial function ⊕ : {0, 0, 1, 1}×{0, 1} → {0, 1, 1} via this table: The entry "−" signifies that ⊕ is not defined on that input.We generalize ⊕ to vectors via and to sets of vectors In a nutshell our algorithm proceeds as follows: Given a graph G = (V, E) of order n, with V = {v 1 , . . ., v n }, it computes tables T 0 , T 1 , . . ., T 2n ⊆ {0, 0, 1, 1} n .Table T l contains a vector a ∈ {0, 0, 1, 1} n if and only if there is a partial labeling ϕ : V → {0, . . ., l} such that : 1. a i = 0 iff v i is not labeled by ϕ and there is no neighbor u of v i with ϕ(u) = l, 2. a i = 0 iff v i is not labeled by ϕ and there is a neighbor u of v i with ϕ(u) = l, 3. a i = 1 iff ϕ(v i ) < l, and 4.
Once we have all tables T l it is easy to find the smallest l such that T l contains at least one vector from {1, 1} n -such vectors correspond to solutions where all vertices are labeled.We then know that such an l is the L(2, 1)-span of G.
Let P ⊆ {0, 1} n be the encodings of all 2-packings of G. Formally, p ∈ P if and only if there is a 2-packing S ⊆ V such that for all i, Our strategy is to compute T l+1 from T l ⊕ P .This is not hard because T l ⊕ P is already almost the same as T l+1 : a ∈ T l+1 iff there is an a ∈ T l ⊕ P such that 1. a i = 0 iff a i = 0 and there is no v j ∈ N (v i ) with a j = 1 2. a i = 0 iff a i = 0 and there is a v j ∈ N (v i ) with a j = 1 3. a i = 1 iff a i = 1, and 4. a i = 1 iff a i = 1.
To compute T l+1 from T l ⊕ P is therefore easy: Look at each vector in T l ⊕ P and determine for each 0 whether it remains 0 or has to be changed into 0. What remains is to find a method to compute T l ⊕ P fast.
Towards this end let us fix a constant k (whose size will be specified later).Let G 1 , . . ., G q be a covering of G by connected subgraphs guaranteed by Theorem 4 and let k be the order of G 1 .Hence, the relation k ≤ k ≤ 2k holds as long as q > 1.
We need one more formalism: If w is a vector and A is a set of vectors, then is the set of all vectors that fall into A after we prefix them with w.Here wv denotes the concatenation of vectors w and v.
If A ⊆ {0, 0, 1, 1} n and B ⊆ {0, 1} n , where n > k , we can compute A ⊕ B in the following useful, though perhaps at first sight complicated, manner: Let us analyze how long it takes to compute A ⊕ B in this manner.We are especially interested in the number of ⊕-operations on sets with vectors of length n − k .We can omit such a computation if the first set, i.e., is empty.So how many pairs v, w are there such that there is at least one u with u ⊕ v = w?If we fix v, then obviously v i = 1 implies w i = 1.So for a fixed v there are at most 2 k −||v|| many w's, where ||v|| denotes the number of positions i such that v i = 1.The total number of pairs v, w such that w = v ⊕ u for some u and that therefore produce a nonempty contribution in ( 5) is therefore at most Thus, if we draw the v's from a set of vectors that represent the 2-packings of a connected graph, then we find at most pp(k ) such pairs and, hence, we need to make only such many recursive computations of ⊕ on sets of vectors of length n − k .
Since we can cover the input graph by induced subgraphs of orders between k and 2k, this is indeed possible.Theorem 4 implies that the total length of the vectors is n ≤ n(1 + 1/k).
In each recursive computation we have to prepare up to pp(k ) many pairs of sets of vectors of length n − k , where k ≤ k ≤ 2k.Then we recursively compute ⊕ on these pairs.From the result we get the next table T l+1 in linear time.Preparing the recursive calls and combining their results takes only time linear in the sizes of A and B. The size of B is at most O(n2 n ) bits and the size of A is at most O(n pp(n )) bits if we use only our tables T l for A: The 1's form a 2-packing and for all other nodes there are only two possibilities, 1 or 0/ 0. We arrive at the following recurrence for the running time: It is not hard to see that the solution is We arrive at our main result by choosing the constant k so big such that pp(n(1+ 1/k)) ≤ 2.6488 n for large n, which is possible because actually pp

Pseudocode of the Algorithm
For the sake of completeness, we provide in this section the pseudocode of the algorithm described in Section 3. Let G 1 , . . ., G q be a covering of a given graph G by connected subgraphs as ensured by Theorem 4. Let d i be the order of G i for 1 ≤ i ≤ q.We denote by n the sum d 1 + • • • + d q .Let A ⊆ {0, 0, 1, 1} n and B ⊆ {0, 1} n .We first provide Algorithm MUL which computes A ⊕ B using the methods from Section 3.
Algorithm M U L(A, B, d1, . . ., dq): Obviously, the body of the innermost loop is executed exactly 24 k times.All operations can be carried out in constant time except set union and the recursive calls to MUL.A set union X ∪ Y takes at most n(|X| + |Y |) steps if we implement sets as simple arrays and remember that we can sort them using radixsort.Not counting recursive calls the running time is therefore O(n(|A| + |B|)) if d 1 = k = O(1).In the border case that q = 1 then a brute force attack to compute A ⊕ B can be carried out in O(n Let (v 1 , . . ., v n ) be the vertices of G (with duplicates allowed) such that (v 1 , . . ., v n ) = (u 11 , . . ., u 1d1 , u 21 , . . ., u 2d2 , . . . . . ., u q1 , . . ., u qdq ) and G i = (u i1 , . . ., u idi ).Let k be a constant large enough so that pp(1 + 1/k) = τ 1+1/k < 2.6488, where τ = 2.6487.. is the positive root of the equation τ 5 = 16τ + 88 as provided in the proof of Theorem 2. As the proof of Theorem 4 is constructive and provides a polynomial-time algorithm to compute a cover G 1 , . . ., G q , we can arrange the decomposition of G into G 1 , . . ., G q in such a way that k ≤ d i ≤ 2k for any 1 ≤ i < q.In addition, Theorem 4 ensure that n ≤ n(1 + 1/k) + O(1).While the correctness of the following algorithm does not depend on such an arrangement, it is crucial to the running time, which is closely related to all pp(G[G i ])'s.We can only guarantee those to be small if the G[G i ]'s are connected.We refer the reader to Section 3 for the running-time analysis.

Fig. 1 .
Fig. 1.Transformation of two leaves with a common neighbor.
Case (B1) with deg(c) > 2 and one neighbor of c is a leaf.

Theorem 3 .
The value of pp(n) is bounded from below by Ω(2.6117 n ).Let a k , b k and c k denote the number of proper pairs in the graphs A k , B k and C k , respectively.Let d k denote the number of such proper pairs (S, X) in the graph D k , in which the 2-packing S does not contain the crossed out vertex.