Arithmetic Progression Graphs

In this paper we study the problem of labeling the edges of a graph with positive integers such that the sequence of the sums of incident edges of each vertex makes a finite arithmetic progression. We give conditions for paths, cycles, and bipartite graphs to have such a labeling. We then address the opposite problem of finding an edge labeled graph for a given finite arithmetic progression. We use a constructive procedure to fully characterize those finite arithmetic progressions that have representations as edge labeled graphs. Then by presenting a pseudo polynomial-time algorithm, we address a more general problem of finding edge labels for a graph when the vertex labels are given. Finally, we count the connected graphs, up to eight vertices, that accept such a labeling by using a simple algorithm that detects a valid edge labeling.


Introduction
A graph labeling is a mapping from graph elements (vertices, edges, faces, or a combination of them) to a nonempty set. Sometimes it is more convenient to consider the range as a set with a structure, like a ring, a field, or a subset of integers. Also, by restricting the type of mappings to injective, surjective, or bijective maps, and also the range of a mapping, one can define many types of labeling. Gallian's updated survey [4] is a comprehensive reference on the subject, see also [12,11]. Among the most studied methods of graph labeling we mention magic labeling [6], edge magic labeling [7], graceful labeling [9,3], (k, d)-arithmetic labeling [1], and super edge-antimagic labeling [2]. In these types of labeling the mapping and its domain are very restricted and few graphs accept those kinds of labelings. The problem of deciding whether every tree has a graceful labeling is an open problem.
One problem that arises naturally is how some of the restrictions can be relaxed to allow for more labeled graphs. To achieve this objective, we will consider those edge labelings of a graph that produce arithmetic progressions on the vertices. To be more specific, we study these two problems: (1) Given a graph G, is it possible to assign positive integers to its edges such that the sequence of the sums of neighboring (incident) edges of each vertex makes a finite arithmetic progression? and (2) Given a finite arithmetic progression of positive integers with n terms, is it possible to find an edge labeled graph with n vertices such that the sequence of the sums of incident edges of its vertices produces the same arithmetic progression? As we see later, there are many graphs that are yes instances for the first question, and we refer to them as Arithmetic Progression Graphs, or APgraphs. We also refer to the type of edge labeling that produces an AP-graph, as an AP-labeling. In Figure 1 a graph with its AP-labeling is depicted. We will also address the second question and give a full characterization of those finite arithmetic progressions that have edge labeled graphs, with respect to our definition.
One applied application area of our research is a somewhat efficient algorithm for finding other graph labelings besides AP-labeling, the main focus of this paper. Our algorithm is constructive and simple but requires a nonconstructive proof of correctness.
The paper is organized as follows. In the next section, after listing some basic results, we present those conditions that are necessary and sufficient to test whether a graph is APlabelable. In Section 3 we present necessary and sufficient conditions for paths and cycles that have AP-labelings; then, a necessary condition is given for bipartite graphs. In Section 4 we study those finite arithmetic progressions that have APgraphs. To this end, constructive procedures are given that find the appropriate graphs for valid arithmetic progressions. A pseudo-polynomial time algorithm is given in Section 5 that determines whether there is an edge labeling for a graph with a given vertex labeling. We finish the paper by presenting some computational results, as summarized in Table 1, that indicate that most graphs are AP-graphs. The paper ends with a conclusion and some remarks on open problems.

Definitions and Basic Results
In this paper we assume that all graphs are simple connected graphs without any loops and multi-edges. We denote the set of the (exclusive) neighbors of a vertex v by N (v). Let G = (V, E) be a graph with n vertices, we say G has an AP-labeling (X, a, d), where X : E → Z + is a total function, a is the initial value, and d is the constant difference of the arithmetic progression a, a + d, ..., a + (n − 1)d such that where σ is a permutation on {0, 1, . . . , n − 1}. If a graph has such a labeling we say it is an AP-graph. Sometimes we just refer to an edge labeling X on a graph G(V, E) by the list of its values on the set of edges as X = (x 1 , . . . , x m ), where m is the number of edges, and X(e i ) = x i , e i ∈ E. The following results are trivial consequences of the definition.
Proposition 1 Let G be a graph of order n and size m. If there is an AP-labeling (X, a, d), such that X = (x 1 , . . . , x m ), then

Proposition 2 Let G be a graph that has an AP-labeling
Due to Proposition 1, each AP-labeling also corresponds to an integer partitioning of K (the sum of an edge labeling) into m positive parts, that can be used as a naive algorithm for finding an AP-labeling for a graph. Also Proposition 4 reduces the problem of finding an AP-labeling for a graph to solving a system of linear equations with positive integer values. In Section 6 we will describe our emperical results by applying these algorithms and enumerating all AP-graphs with up to eight vertices.

Paths, Cycles and Bipartite Graphs
Note that with respect to Proposition 4, to find an APlabeling (X, a, d) for a graph we need to choose not only proper values for a and d, but also a proper permutation σ, that distributes terms of the corresponding arithmetic progression among the vertices of the graph. In this section we show that, when dealing with paths and cycles, finding an AP-labeling is equivalent to finding a proper permutation.
Theorem 5 Let P be a path of length n, then P has an APlabeling (X, a, d) if and only if there is a permutation σ that satisfies the following conditions.
for a permutation σ on {0, . . . , n − 1}. Now we multiply both sides of the ith equation with (−1) i−1 . By adding the first k terms, 1 ≤ k < n, for odd values of k we have and since the values of labels are positive integers, we get the desired inequalities of Statements 1 and 2 in the theorem. The same argument applies for Statement 3, by adding all terms.
For proving the sufficient condition note that given a permutation σ, that satisfies the conditions, we can compute the values of the edge labels by and Statements 1-3 ensure us that the values of the labels are positive integers. ⊓ ⊔ Theorem 6 Let C be a cycle of length n, then C has an APlabeling (X, a, d) if and only if there is a permutation σ that satisfies the following conditions.
1. If the value of n is odd, . . , v n−1 , e n−1 , v n , e n , v 1 be a cycle. If we write the appropriate system of linear equations, we have: Arithmetic Progression Graphs Now, as in the case of paths, if we multiply each ith equation with (−1) i−1 and add all the resulting terms, for the case when n is odd we have , then by solving the other equations with respect to the value of x n , for 1 ≤ k < n, we have .
When n is even, all variable are cancelled and we have Note that in this case by adding the first k terms when k is odd, 1 ≤ k < n, we have and when k is even, 2 ≤ k < n − 1, we have and since the values of edge labels are positive integers we have when k is odd, There is no AP-labeling for paths and cycles of length n, when n ≡ 2 (mod 4).
As we saw earlier, there are some paths and cycles that do not accept any AP-labeling. By the next theorem, we show it is not restricted to just those type of graphs. There are other bipartite graphs that have the same property. In Section 6 we use the following theorem and its corollary to prove that many of those graphs that are illustrated in Figures 3 and 5 are not AP-graphs.
Theorem 8 Let G be a bipartite graph with p and q vertices in each part such that p ≥ q. If G has an AP-labeling (X, a, d), then Proof. By constructing the appropriate system of linear equations and multiplying those terms that represent sums of vertices in the part with q vertices by −1, and adding the equations, we have The left hand side of the last inequality takes its largest value when That yields

⊓ ⊔
The following corollary is a result of the proof of the previous theorem.
Corollary 9 A bipartite graph with n vertices and equal parts has no AP-labeling, when n ≡ 2 (mod 4).
As easily seen by Theorem 8 one class of graphs that accepts no AP-labeling is the set of stars {K 1,p | p ≥ 3}. The next theorem shows that if a graph is close to a star with respect to a few number of edge contractions, then it also has no AP-labeling.
We consider G 0 = G and we denote by G i the resulting graph of the contracting e i in G i−1 , i = 1, . . . , k. After contracting an edge e i = xy to a vertex v xy , we relabel the edges of G i by the following rule. If a vertex w was adjacent to both x and y, we replace any multiple edges by a new edge wv xy and we assign the sum of the labels of wx and wy in G i−1 to it. The labels of other edges remain unchanged. After iteration i we have a new vertex labeling l i : After contracting all edges we reach to a bipartite graph with two parts, part A that has vertices that do not belong to H, and part B that has only the center c of the star G k . Since each edge has one side in each part we have and since, k < < n 2 , the number of nodes in the contracted part of graph is less that the number of nodes in the non-contracted part, so we have ∑ to make right hand side as large as possible we need to find a value 1 ≤ k < n such that we have: The statement of the theorem follows by solving the last inequality with respect to the variable k. ⊓ ⊔

Graphs of Finite Arithmetic Progression
Let the sequence S = (a, a + d, . . . , a + (n − 1)d) be a finite arithmetic progression of positive integers with the initial value a and the constant difference d. In this section we try to find out whether there is an AP-graph G with n vertices, such that the set of the sums of neighboring edges of the vertices results in the same sequence as S. To this end, we first consider the case when a = d and we introduce a constructive procedure to make a desired graph for a given sequence. Also we show that there are arithmetic progressions that have no representation as an AP-graph. Later on, we extend our results for the case when a ̸ = d.
Throughout the proofs of the following results we suppose that the vertices of a graph are indexed with respect to the increasing order of their labels. Also we consider the operation of pairing and incrementing by c on a sequence of even number of vertices v s , . . . , v s+k , where k is odd. That is done by considering pairs of consecutive vertices (v i , v i+1 ), i ∈ {s, s + 2, . . . , s + k − 1}, and if there is an edge between them, we increment its label by c. When there is no edge, we connect them by an edge and we assign c as its label. Note that by this operation the vertex label of each vertex in v s , . . . , v s+k , is incremented by c. Proof. Let us first consider the case when d is even. If S has three terms, say S = (d, 2d, 3d), the graph shown in Figure 2 is an appropriate AP-graph. Now we follow the argument inductively by considering two cases, when the number of terms is odd or even. Suppose we have an AP-graph G for S = (d, . . . , (n − 1)d). If n is even then we do the pairing and incrementing by d operation for the sequence of vertices v 2 , . . . , v n−1 in G. Then we add a new vertex u and connect it to v 1 by an edge labeled by d. The resulting graph is an AP-graph for the sequence (d, 2d, . . . , nd).
For the case when n is odd, we do the pairing and incrementing operation by d for the sequence of vertices v 3 , . . . , v n−1 in G. Then we add a new vertex u and we connect it to v 1 and v 2 by two edges, each has d 2 as its label. At last, if there is an edge between v 1 and v 2 we increment it by d 2 , otherwise we connect them by a new edge that is labeled by d 2 . Now we prove that for odd value of d and n ≡ 3 (mod 4), if there is an AP-graph G for S with n − 4 terms, then there is an AP-graph for S with n terms. The base case when n = 3 follows easily by considering the graph illustrated in Figure 2, so we suppose that n ≥ 7. We first employ the pairing and incrementing by 4d on the sequence of vertices v 2 , . . . , v n−4 in G, such that the label of each vertex in this sequence increases by 4d. Then we add four new vertices u 1 , u 2 , u 3 , and u 4 . Finally, we add an edge from u 1 to u 4 labeled by d, an edge from u 2 to u 3 labeled by 2d, an edge from u 3 to v 1 labeled by 2d, and an edge from u 4 to v 1 labeled by 2d.
Now let consider the case when d is odd and n ≡ 0 (mod 4). Since n − 1 ≡ 3 (mod 4), there is an AP-graph G for the sequence (d, 2d, . . . , (n − 1)d). We apply the operation of pairing and incrementing by d for the sequence of vertices v 2 , . . . , v n−1 in G. By adding a new vertex u and connecting it to v 1 with an edge labeled by d, we get the desired graph.
To prove that there is no AP-graph when d is odd and n ≡ 1, 2 (mod 4). Let (X, d, d) be an AP-labeling of a graph G with the edge labels X = (x 1 , x 2 , . . . , x m ). Then due to Proposition 1 the value of  is odd, a is even, and n ≡ 0, 1 (mod 4), or Proof. To prove this theorem we first apply Lemma 11 to produce an AP-graph G with n − 1 vertices for S ′ = (d, 2d, . . . , (n − 1)d), for valid numbers of d and n. We use two procedures to construct an AP-graph from G for S based on the number of terms in S ′ . The first procedure is used when the number of terms in S ′ is odd. It is done by pairing and incrementing operation by a for the sequence of v 2 . . . . , v n−1 , and then adding a new vertex and joining it to v 1 with an edge labeled by a. The second procedure is used when the number of terms in S ′ and a are both even. In this procedure we apply the operation of pairing and incrementing by a on v 3 , . . . , v n−1 , then we add a new vertex and attach it to v 1 and v 2 by edges that are labeled by a 2 . Finally, if there is an edge between v 1 and v 2 we increment it by a 2 , otherwise we join them by a new edge labeled by a 2 . These procedures, when applied properly, give the proofs for Statements 1-3 and the part of Statement 4 when n ≡ 0 (mod 4). Now let us consider the case where d and a are odd and n ≡ 3 (mod 4). Since n ≡ 3 (mod 4), we have n − 3 ≡ 0 (mod 4). So by Lemma 11 there is an AP-graph G for the sequence (d, 2d, . . . , (n − 3)d). We first apply a pairing and incrementing by a + 2d for the sequence v 3 , . . . , v n−3 . Then we add three new vertices u 1 , u 2 , and u 3 to the resulting graph. To complete the construction, we add two edges labeled by a+d 2 from u 3 to both v 1 and v 2 . Also we connect u 1 to u 2 by an edge labeled by a, and u 2 to u 3 by an edge labeled by d. At last if there is any edge between v 1 and v 2 we increment it by a+3d 2 , otherwise we add them via a new edge labeled by a+3d 2 . With respect to Proposition 1, the same argument as presented for Lemma 11 also applies to the no instances in this theorem.

⊓ ⊔
To complete the characterization of those arithmetic progression sequences that are vertex labels for some AP-graph, first note that there are no sequences of length less than three. Also, for n = 3 there are only two graphs to consider. It is easy to see that the path (see Figure 2) must have a = d. For the complete graph K 3 we get only those sequences satisfying a > d and a + d even.

Decision algorithms
In this part we present two complexity results on edge labeling of a graph that is closely related to the problem of deciding if a graph has an AP-labeling. We first consider the problem of finding edges labels for a graph such that the sums of the edge labels incident to each vertex yield a specified target set of vertex labels. We show that the problem is NP-complete by reducing a restricted version of the partition problem into two equal-sized partitions, denoted here by EQUALPARTITION, (see [SP12] in [5]).
Proof. It is easy seen that the problem is NP. To show NPhardness of the problem we reduce from EQUALPARTITION. Let {s 1 , s 2 , . . . , s n } be an instance of EQUALPARTITION. If either n or S ′ = ∑ n i=1 s i is odd then we map to a known no instance of FREEINCIDENTEDGELABELABLE, say G = K 2 and A = {1, 2}. Otherwise, we transform it to a graph G with n + 2 vertices created by adding an edge between the centers of two stars K 1,n/2 and set A = {s 1 , . . . , s n , S ′ , S ′ }. Clearly, if the graph G can be edge labeled by some h, yielding vertex labels A = {f (1), . . . , f (n + 2)}, then the two center vertices must end up with the two labels S ′ . The only way to do this is for the connecting edge to have label S ′ /2 and the edges incident to the pendant vertices having labels that partition {s 1 , . . . , s n } into two parts of size n/2, each part summing up to S ′ /2.
⊓ ⊔ Our next result shows that by assigning fixed values to vertices, finding a proper edge labeling that produces that vertex labeling is almost polynomial-time solvable.
Problem 15. FIXEDINCIDENTEDGELABELABLE Input: Connected undirected graph G = (V, E) with a vertex labeling f : V → Z + . Question: Does there exist an edge labeling g : Theorem 16 There exists a pseudo polynomial-time algorithm to decide the problem FIXEDINCIDENTEDGELA-

BELABLE.
Proof. We give a decision algorithm that runs in time that is bounded by a polynomial of n = |V | and the sum T = ∑ v∈V f (v).
The idea for the algorithm is to start with an initial assignment of edge weights and gradually increase them until the incident edges sum up to the desired vertex labels. We say a vertex is unsaturated if the sum of its incident edges is strictly less than its label. We use an approach similar to the augmenting path techniques used in many maximal matching algorithms. If there is an odd length sequence of edges, starting and ending at a unsaturated vertices (which could be the same vertex), then we can improve the saturation level of the system by adding, in an alternating fashion, +1 and -1 to the edges in this walk sequence. Here only the saturation levels of the first and last vertices increase by one. To ensure that each edge label stays positive we only apply this augmentation when all of the even-indexed edges have value at least 2. We call such a path an improving walk. The details of the algorithm are sketched in the procedure given in Figure 4.
The program will terminate with at most T /2 iterations of the while loop at line L1 since the sum of saturation levels always increases by two. To find an improving walk we need to do a graph traversal using breadth-first search. We need to consider whether each of the other vertices is reachable at only an odd or even distance (not all the distances) from the starting vertex. Thus the search tree size is bounded by 2n, and this can be computed in O(n 2 ) = O(m) steps.
For correctness of the algorithm, if we saturate all of the vertices then we clearly have found a desired edge labeling (when the while loop at L1 terminates).
There is a special case where there may be an improving walk (circuit) from v to itself but s[v] + 2 > f [v]. Consider that we could have augmented this circuit (i.e. increase s [v] by 2) then decrease another incident edge vw of v by 1 to get s[v] = f [v]. This would mean that another unsaturated vertex y is the start of an improving path that ends at w. Thus we only do this special case if we can find a replacement improving path from y to w. Now suppose the procedure can not find an improving walk from an unsaturated vertex v. This means that we have created a reachability tree from v (of all saturated vertices except v) where each edge e at even level has g[e] ≥ 2. Each leaf u of this tree must either have all its neighbors already in the tree, or u is an odd distance from v and the edge label is 1 to a vertex not in the tree. By contradiction, assume the graph has an edge labelable g ′ such that each vertex is saturated but the algorithm halts with unsaturated vertices, given by g. Consider the edges incident to an unsaturated vertex u 0 . There must be an edge u 0 u 1 such that g[u 0 u 1 ] < g ′ [u 0 u 1 ]. We will show that there exists an improvable walk in the graph (not necessarily starting at u 0 ). Increase g[u 0 u 1 ] by one. Vertex u 1 must have been saturated before the increase (otherwise we would have an improvable walk of length 1). Thus since u 1 is (now) oversaturated there must be an edge u 1 Decrease g[u 1 u 2 ] by one. Then the process of incrementing/decrementing values of g[u i u i+1 ] continues. Since the relabeling of g is converging to g ′ we must eventually reach an unsaturated vertex u i+1 . If i + 1 is odd then we found an improving walk. Otherwise, start a new walk at the unsaturated vertex u i+1 and continue the process of converting g to g ′ . Since we assumed the graph is edge labelable and ∑ e∈E |g ′ [e]−g[e]| is bounded we eventually have to increase the value of an unsaturated vertex u 2k+1 . This only happens if we have an odd length walk (or discover an improving walk u 2(k−j) , . . . , u 2k , u 2k+1 , 0 ≤ j ≤ k). Thus, our assumption that the algorithm halts is wrong. Thus, the algorithm will find some labeling if one exists.
⊓ ⊔ Note the running-time of the algorithm given in the previous proof of Theorem 16 should be implementable in time O(n 3 T ). Thus if the maximum vertex label is bounded by some constant k then we have an algorithm that is fixedparameter tractable via an O(kn 4 ) time algorithm. To solve our AP-labeling problem we have to apply this algorithm n! times, once for each permutation of {a, a+d, a+2d, . . . , a+ (n − 1)d} assigned as vertex labels. This running time is theoretically better than both our brute-force integer partition algorithm (Proposition 1) and integer programming algorithm (Proposition 4).

Experimental Results
In this section, as a part of our study, we are concerned with the problem of classifying all small graphs (with order at most eight) as having an AP-labeling or not. Our computational results are summerized in Table 1. Drawings of the smaller set of no instances are shown in Figures 3, 5 and 6. To achieve this goal, we implemented (using in Sage [10] libraries) the two simple brute-force algorithms based on the results of Propositions 1 and 4. When the number of edges m was at most the number of vertices n we used the simple algorithm based on Proposition 1, that is, we generated all integer partitions of K into m parts. However, in most cases, the size m was larger than the order n and we reduced our problem to an equivalent integer programming problem and called the efficient Sage/Singular IP solver for n linear equations. In both cases, we considered a wide range of the values of a and d and tried all permutations of its edges or vertices, respectively. We used geng program [8] to produce all simple connected graphs up to eight vertices. For each graph, if the invoked algorithm finds an AP-labeling, then it saves the result and terminates. For example, Figure 7 displays AP-labelings for each of the AP-graphs with four vertices. Both our Sage programs and the first found AP-labelings for the other yes instances (8 ≥ n ≥ 5) are available from the authors, on request.
Note that even if the algorithm fails in finding any solution for a given graph, it does not guarantee the nonexistence of an AP-labeling (since we did not try all combinations of a and d). So we need a formal proof for the no instances. Fortunately, all of these remaining cases are easily confirmed as not having an AP-labeling from our theoretical results of Section 3, as discussed below.
Note that by Theorem 8 we know that any star with more than four vertices is not an AP-graph; this applies to the three stars in the figures. The other graphs in Figure 3 have six vertices and are bipartite and as they have parts with equal size, by Corollary 9 we know that they do not accept any APlabelings. To prove that the remaining three graphs in Figure 5 are not AP-graphs we use Theorem 10. We see, in each case, that only one edge (i.e. k = 1) needs to be contracted to produce the star K 1,5 allowing us to use Theorem 10.
Likewise, the fact that none of the graphs in Figure 6 is an AP-graph follows from Theorem 8 and (using k ≤ 2) Theorem 10.

Conclusions
In this paper we have introduced a new graph labeling problem to decide whether a graph's vertices can be labeled as an arithmetic progression (under constraints of being induced from edge labelings by positive integers). We have developed three different algorithms: a simple brute-force integer partition algorithm, a mapping to an instance of integer programming, and, one based augmenting improvement of vertex saturations. By experimental search, we have discovered that most connected graphs are AP-graphs. It is observed that most of the 'no'-cases are sparse graphs and starlike. In the other direction, we have characterized all arithmetic sequences that are representable by some AP-graphs.
There are several open questions related to our work in this new area. First, we would like to find a polynomialtime algorithm or (more likely) a proof that the AP-graph decision problem is NP-complete. For a given graph we know that we can scale an edge-labeling (X, a, d) to get another (X ′ , k · a, k · d) labeling by simply setting X ′ (e) = k · X(e), e ∈ E(G). However, we would like to know how many non-equivalent labelings a graph has, which would be a nice characteristic of the structure of a graph. In particular, what are the smallest a and d that need to be checked for a graph of order n and m. Currently, we do not know of an upper bound for the smallest a and d and need to either get lucky with a guess or prove (by hand or using the limited structural constraints of Section 3) that no such arithmetic progression exists.