The maximum number of cycles in a graph with fixed number of edges

The main topic considered is maximizing the number of cycles in a graph with given number of edges. In 2009, Kir\'aly conjectured that there is constant $c$ such that any graph with $m$ edges has at most $(1.4)^m$ cycles. In this paper, it is shown that for sufficiently large $m$, a graph with $m$ edges has at most $(1.443)^m$ cycles. For sufficiently large $m$, examples of a graph with $m$ edges and $(1.37)^m$ cycles are presented. For a graph with given number of vertices and edges an upper bound on the maximal number of cycles is given. Also, exponentially tight bounds are proved for the maximum number of cycles in a multigraph with given number of edges, as well as in a multigraph with given number of vertices and edges.


Introduction
Counting the number of cycles in a graph is a problem that was studied for different classes of the graphs: graphs with given cyclomatic number, planar graphs, 3-regular and 4-regular graphs, and many others. However, only a few general bounds for number of cycles that use basic graph parameters are known. In this paper the bounds on the number of cycles in a graph as a function of number of vertices and edges are presented.
Let C(G) denote the number of cycles in a graph G. In 1897, Ahrens [1] proved that for a graph G with n vertices, m edges and k components, The lower bound in (1) is tight; for example, it is achieved by any disjoint union of cycles and trees. The tightness of the upper bound in (1) was shown by Mateti and Deo [9] and the only graphs for which the upper bound is tight are K 3 , K 4 , K 3,3 and K 4 − e. Aldred and Thomassen [2] improved the upper bound in (1) by showing that for a connected graph G, Entringer and Slater [5] considered C(G) for the class of connected graphs with fixed cyclomatic number r = m − n + 1. It follows from the results of [5] that there is a 3-regular connected graph G for which C(G) > 2 r−1 . Shi [11] presented an example of an outer-planar 3-regular Hamiltonian graph G with C(G) = 2 r−1 + r − 1.
Király [7] investigated C(G) for several classes of graphs: the union and the sum of two trees, 3-regular and 4-regular graphs, and graphs with average degree 4. Király also conjectured that there is a constant c, such that for any graph G that has m edges, Aldred and Thomassen [2] studied C(G) for the class of planar graphs. Arman, Gunderson and Tsaturian [3] studied C(G) for the class of triangle-free graphs on n vertices. In this paper, C(G) is investigated for two other classes of graphs: those with n vertices and m edges, and those with m edges.
The following notation is used. For k ∈ Z + , denote {i ∈ Z; 1 ≤ i ≤ k} by [k], and for a set S, denote {T ⊆ S : |T | = k} by [S] k . Graphs and multigraphs are defined as in [4]. Denote the average degree of a graph G by d(G), the maximum degree by ∆(G), and the minimum degree by δ(G).
Theorem 3.1 implies that if graph G has n vertices and m edges, then The bound in (3) is better than in (2) for graphs with sufficiently large number of edges and average degree at least 4.25.
For m ∈ Z + let C(m) be the maximum number of cycles in a graph with m edges. In Corollary 3.4 it is shown that which for m > 4056 implies C(m) < 1.443 m .
Theorem 3.1 and Corollary 3.4 are proved in Section 3. In Section 2 it is shown that extremal graphs for C(m) have bounded degrees. Namely, it is shown (Theorem 2.1) that if G is a graph with m edges with C(G) = C(m), then ∆(G) ≤ 11.
In Section 4, for m sufficiently large, a graph G with m edges is constructed, Corollary 3.4 and the result of Section 4 imply that for m large enough, In Section 5, the problems of maximizing number of cycles in multigraphs with given number of edges or given number of vertices and edges are considered. It is shown (Theorem 5.2) that if G is a multigraph that has the most cycles among all multigraphs with m "multi-edges", then 2 Maximal degree of graphs with C(m) cycles Recall that, for m ∈ Z + , C(m) is the maximum number of cycles in a graph with m edges.
The proof of Theorem 2.1 relies on the following two lemmas.
Lemma 2.2. Let k ≥ 6 be a positive integer. For 1 ≤ i < j ≤ k, let w i,j be a non-negative real number, and let S = 1≤i<j≤k w i,j . Then there exists a 6-element set D ⊆ [k] such that Proof. The proof relies on an averaging argument.
Let X be a collection of all 6-element subsets of [k]. For D ∈ X let Let S(D) be the average of S(D) over all D ∈ X, then There exists D ∈ X, such that S(D) ≥ S(D), i.e.
Lemma 2.3. Let k ≥ 2 be a positive integer. For 1 ≤ i < j ≤ k, let w i,j be a non-negative real number, and let S = 1≤i<j≤k w i,j . Then there exists a partition Proof. For all l ∈ [4] let a l = ⌊ k+l−1 4 ⌋ (note that a 1 + a 2 + a 3 + a 4 = k). Let X be the collection of all ordered quadruples ( and for all l ∈ [4], |A l | = a l . Note that Let S(p) be the average of S(p) over all possible choices of p.
p∈X: i,j∈A l w i,j |X| Note that for any choice of l ∈ [4] and any choice of i, j, such that 1 ≤ i < j ≤ k there are exactly (k − 2)!(a l )(a l − 1) a 1 !a 2 !a 3 !a 4 ! quadruples p ∈ X, such that i, j ∈ A l . Then, There exists a p = ( Proof of Theorem 2.1. Let m be a positive integer and G be a graph with m edges. To prove Theorem 2.1, it is sufficient to prove that if ∆(G) ≥ 12, then there is a graph H with m edges and with C(H) > C(G). Let ∆(G) ≥ 12 and u be a vertex of maximal degree in G. Let N (u) = {u 1 , u 2 , . . . , u k } be the neighbourhood of u (note that k ≥ 12). For 1 ≤ i < j ≤ k, define w i,j to be the number of paths from the vertex u i to the vertex u j in the graph G−u. Then the number of cycles in graph G that pass through vertex u is u G: Figure 1: Constructing graph H from G.
To count the number of cycles in H, note the following: • Every cycle in G that does not pass through the vertex u is still a cycle in H. There are C(G) − S such cycles.
• Let C be a cycle in G that for some 1 ≤ i < j ≤ k − 6 contains a path u i uu j . If for some l ∈ [4] u i and u j are in the same class U l , then C corresponds to the cycle in H that uses the path u i v l u j instead of u i uu j . In the case if u i ∈ U l and u j ∈ U m for some 1 ≤ l < m ≤ 4, cycle C corresponds to the cycle that uses the path u i v l v m u j instead of u i uu j . By (5), there are at least • Every cycle in G that for some i ∈ A l and j ∈ A m with l = m contains a path u i uu j gives rise to additional 4 cycles in H(except the one containing According to (6), there are at least By all of the observations above, the number of cycles in H is Therefore, H has more cycles than G.
Note, that for m = 7 the graphs that have the most cycles are K 4 plus an edge and K 4 with one edge replaced by a path of length two. In the first case minimum degree is one, in the second case -two. The authors can also prove the following theorem (that does not have direct relation to the main results of this paper).

Cycles in graphs or multigraphs with fixed number of vertices and edges
Multigraphs are defined as in [4]. Theorem 3.1. Let G be a multigraph with n ≥ 2 vertices and m edges.
To prove Theorem 3.1, some notations and lemmas are needed. Let G be a multigraph with n vertices . For vertices v 1 Proof. Fix n ≥ 2. Let G be a multigraph on n vertices. The proof is by mathematical induction on l = n − k. Base case. Let l = 1. Let v 1 e 1 . . . v n−1 be a path in G; C n−1 is to be bounded. The condition F n−1 = ∅ means that F n−1 = {v n } and it remains to be proved that C n−1 ≤ f n−1 f n . Let s be the number of edges between v n−1 and v 1 . Then C n−1 ≤ s + (f n−1 − s)f n . By definition, f n ≥ 1; therefore s + (f n−1 − s)f n ≤ sf n + (f n−1 − s)f n = f n−1 f n , which proves the base case. For all possible choices of v n−i and e n−i−1 , according to inductive hypothesis, Therefore, This proves that the statement of the lemma holds for l = i + 1, and therefore by induction it holds for all l ∈ [n − 1]. Proof. Let G be a multigraph with n ≥ 3 vertices and m edges, and v 1 be a vertex with degree ∆(G). For any edge e = v 1 v 2 incident to v 1 , by Lemma 3.2, the number of cycles that contain e is at most Every cycle through v 1 contains two such edges, therefore the number of cycles that contain v 1 is at most Let v 2 , . . . v t be a collection of vertices that give the maximum in (7) with the smallest possible t. Then f t ≥ 2 (otherwise remove all f i = 1 after the last f k ≥ 2 to obtain the smaller collection of vertices that gives maximum in (7)). Then for all 2 ≤ i ≤ t, So the number of cycles in G that contain v 1 is at most For a fixed t the product x 2 . . . x t in (8) obtains its maximum when x i s (i ≥ 2) are as equal as possible (for all i, j |x i − x j | ≤ 1), and their sum is equal to m.
, let the maximum in (8) be achieved for some t ≤ n and let x 2 , · · · , x t be a collection of x i s that gives the maximum in (8). If t < n, then s ≥ 3 implies that either for some i ∈ [t], x i ≥ 5, or for two different i, j ∈ [t], x i = x j = 4. In the first case replacing x i by x i − 2 and setting x t+1 = 2 gives a collection of x i s with a bigger product. In the second case setting x i = x j = 3 and x t+1 = 2 increases the product of x i s. Hence, the maximum in (8) is achieved when t = n. For all 2 ≤ i ≤ n, x i = s or x i = s + 1. Then the number of cycles in G that pass through v 1 is at most If s < 3, let the maximum of (8) be achieved for some 2 ≤ t ≤ n and let x 2 , · · · , x t be the collection of x i s that gives the maximum in (8). Recall that for all i, j |x i − x j | ≤ 1. If for two different i, j ∈ [t] x i = x j > 3, then m > 6 + 3(t − 2) = 3t, and s < 3 implies that t < n. Replacing x i by x i − 1, x j by x j − 1 and setting x t+1 = 2 increases the product. Therefore, there is at most one i, such that x i = 4. If there is i such that x i = 1, then replacing any x j (j = i) by x j + 1 and deleting x i increases the product. If for some i, j, k ∈ [t] x i = x j = x k = 2, then replacing x i by 3, x j by 3 and deleting x k increases the product. Therefore, {x 2 , . . . , x t } ∈  {{3, 3, . . . , 3, 2, 2}, {3, 3, . . . , 3, 4}, {3, 3, . . . , 3, 2}, {3, 3, . . . , 3}}. Then x 2 . . . x t is at most 3 m 3 , so the number of cycles that pass through v 1 is at most Proof of the Theorem 3.1. The proof is by mathematical induction on n. Base case. If n = 2, there is only one multigraph on n vertices with m edges -two vertices connected by m edges. In this case s = m n−1 = m, and G has max{ m 2 , 0} cycles, which is less than 3 4 m( 3 √ 3) m (for the case m < 3), and less than 3 4 m · m (for the case m ≥ 3). Inductive step. Let k ≥ 3 be an integer, and suppose that the statement of the theorem is proved for n = k − 1. Let G be a multigraph with k vertices, m edges and let v 1 be a vertex of maximal degree in G. Suppose that m k−1 < 3. If ∆(G) ≤ 2, then every edge is contained in at most one cycle, and every cycle contains at least two edges, so the number of cycles in G is at most 3) m , therefore the total number of cycles in G is at most Note that the function f (x) = (⌊x⌋) 1−x+⌊x⌋ (⌊x⌋ + 1) x−⌊x⌋ is non-decreasing on every interval [a, a + 1], a ∈ Z ≥0 (and hence on R + ), therefore If y ≥ 3, then, by the induction hypothesis, If y < 3, then |E(G − v 1 )| < 3(k − 2), and by the induction hypothesis Hence, for any y, |E(G − v 1 )| ≤ 3 4 ∆(G)(s 1−α (s + 1) α ) k−2 , which together with Lemma 3.3 and (9) implies that which proves the inductive step and hence the theorem.
A consequence of Theorem 3.1 is For n ≥ 1 denote by P (n) the number of paths from the vertex u 1 to the vertex u n+1 in H n . Note that P (n) is also equal to the number of paths from u 1 to v n+1 in H n .
Proof sketch. The proof of the claim relies on an inductive argument and an observation that each path from u 1 to u n+1 in H n corresponds to exactly one of the following paths: • path from u 1 to u n in H n−1 followed by the path u n u n+1 or by the path u n v n+1 u n+1 .
• path from u 1 to v n in H n−1 followed by the path v n u n+1 or by the path v n v n+1 u n+1 .
• path from u 1 to u n−1 in H n−2 followed by the path u n−1 u n v n+1 v n u n+1 or by the path u n−1 v n v n+1 u n u n+1 .
• path from u 1 to v n−1 in H n−2 followed by the path v n−1 u n v n+1 v n u n+1 or by the path v n−1 v n v n+1 u n u n+1 .
Solving the recurrence relation leads to the inequality Define the graph G n by identifying vertices u 1 and u n in H n . Then G n has 2n + 1 vertices, m = 5n + 1 edges and For an integer m let graph G be obtained from G ⌊ m−1 5 ⌋ by adding (m − 5⌊ m−1 5 ⌋ − 1) edges. Then G has m edges and for m large enough

Maximum number of cycles in multigraphs
The problems of maximizing the number of cycles with fixed number of edges or fixed average degree can be also considered for multigraphs. Using the techniques presented in this paper, the authors can prove the following two results.
Theorem 5.1. Let G be a multigraph that has the maximum number of cycles among all the multigraphs with n ≥ 2 vertices and m ≥ 3 edges. Let ⌊ m n−1 ⌋ = s, α = m n−1 − s. If m n−1 ≥ 3, then The upper bounds in Theorem 5.1 follow from the Theorem 3.1. For the lower bounds, define C n,m to be the multigraph obtained from the cycle C n by replacing each of some m − ⌊ m n ⌋n consecutive edges with ⌊ m n ⌋ + 1 "multi-edges" and the rest ⌊ m n ⌋n − m + n edges with ⌊ m n ⌋ "multi-edges". The lower bound in the first case is achieved by the graph C n,m . The lower bound in the second case is achieved by the graph C ⌊ m+1 3 ⌋,m with extra n − ⌊ m+1 3 ⌋ isolated vertices. Theorem 5.2. Let G be a multigraph with m ≥ 3 edges that has the maximum number of cycles among all the multigraphs with m edges. Then

3) m
The upper bound in Theorem 5.2 can be obtained by repeating the argument of Corollary 3.4 and a version of Theorem 2.1, modified for multigraphs. The example for the lower bound is the same as for the second case of Theorem 5.1. Theorems 5.1 and 5.2 answer both questions for multigraphs up to a constant factor. The authors believe that for m ≥ 9 the graph C ⌊ m+1 3 ⌋,m has the most cycles among all multigraphs with m edges. For d = Ω(ln n), let G be a random graph G(n, p) with p = d n−1 . Glebov and Krivelevich [6] proved that the number of cycles in G is a.a.s. at least This inequality and the fact that C(K n ) ≈ c √ n n e n for some constant c (see [3] for details) motivates the following conjecture. As mentioned in the introduction, Theorem 3.4 and the result of Section 4 imply that 1.37 m ≤ C(m) ≤ 1.443 m .