Open Journal of Discrete Mathematics
Vol.06 No.02(2016), Article ID:65254,29 pages
10.4236/ojdm.2016.62005
On the Number of Cycles in a Graph
Nazanin Movarraei, Samina A. Boxwala
Department of Mathematics, University of Pune, Pune, India

Copyright © 2016 by authors and Scientific Research Publishing Inc.
This work is licensed under the Creative Commons Attribution International License (CC BY).
http://creativecommons.org/licenses/by/4.0/


Received 7 October 2015; accepted 28 March 2016; published 31 March 2016
ABSTRACT
In this paper, we obtain explicit formulae for the number of 7-cycles and the total number of cycles of lengths 6 and 7 which contain a specific vertex vi in a simple graph G, in terms of the adjacency matrix and with the help of combinatorics.
Keywords:
Adjacency Matrix, Cycle, Graph Theory, Path, Subgraph, Walk

1. Introduction
In a simple graph G, a walk is a sequence of vertices and edges of the form
such that the edge
has ends
and
. A walk is called closed if
. In graph theory, a path in a graph is a finite or infinite sequence of edges which connect a sequence of vertices which, are all distinct from one another. A closed path (with the common end points) is called a cycle.
It is known that if a graph G has adjacency matrix
, then for
the ij-entry of
is the number of
walks of length k in G. It is also known that
is the sum of the diagonal entries of
and
is the degree of the vertex
.
In 1971, Frank Harary and Bennet Manvel [1] , gave formulae for the number of cycles of lengths 3 and 4 in simple graphs as given by the following theorems:
Theorem 1. [1] If G is a simple graph with adjacency matrix A, then the number of 3-cycles in G is
. (It is known that
).
Theorem 2. [1] If G is a simple graph with adjacency matrix A, then the number of 4-cycles in G is


Theorem 3. [1] If G is a simple graph with n vertices and the adjacency matrix
of 5-cycles in G is
In 2003, V. C. Chang and H. L. Fu [2] , found a formula for the number of 6-cycles in a simple graph which is stated below:
Theorem 4. [2] If G is a simple graph with adjacency matrix A, then the number of 6-cycles in G is
Their proofs are based on the following fact:
The number of n-cycles (

closed walks of length n, which are not n-cycles.
In 1997, N. Alon, R. Yuster and U. Zwick [3] , gave number of 7-cyclic graphs. They also gave some for- mulae for the number of cycles of lengths 5, which contains a specific vertex 
In [3] - [9] , we have also some bounds to estimate the total time complexity for finding or counting paths and cycles in a graph.
In our recent works [10] [11] , we obtained some formulae to find the exact number of paths of lengths 3, 4 and 5, in a simple graph G, given below:
Theorem 5. [11] Let G be a simple graph with n vertices and the adjacency matrix
paths of length 3 in G is
Theorem 6. [11] Let G be a simple graph with n vertices and the adjacency matrix
paths of length 4 in G is
Theorem 7. [11] Let G be a simple graph with n vertices and the adjacency matrix
paths of length 3 in G, each of which starts from a specific vertex 

Theorem 8. [11] Let G be a simple graph with n vertices and the adjacency matrix


Theorem 9. [10] Let G be a simple graph with n vertices and the adjacency matrix

Theorem 10. [10] If G is a simple graph with n vertices and the adjacency matrix
of 4-cycles each of which contains a specific vertex 

In [3] we can also see a formula for the number of 5-cycles each of which contains a specific vertex 
Theorem 11. [12] If G is a simple graph with n vertices and the adjacency matrix


In this paper, we give a formula to count the exact number of cycles of length 7 and the number of cycles of lengths 6 and 7 containing a specific vertex 
2. Number of 7-Cycles
In 1997, N. Alon, R. Yuster and U. Zwick [3] , gave number of 7-cyclic graphs. The n-cyclic graph is a graph that contains a closed walk of length n and these walks are not necessarily cycles. In this section we obtain a formula for the number of cycles of length 7 in a simple graph G with the helps of [3] .
Method: To count N in the cases considered below, we first count 

Theorem 12. If G is a simple graph with n vertices and the adjacency matrix
7-cycles in G is

Proof: The number of 7-cycles of a graph G is equal to
walks of length 7 that are not 7-cycles. To find x, we have 11 cases as considered below; the cases are based on the configurations-(subgraphs) that generate all closed walks of length 7 that are not 7-cycles.
In each case, N denotes the number of closed walks of length 7 that are not 7-cycles in the corresponding subgraph, M denotes the number of subgraphs of G of the same configuration and





Case 1: For the configuration of Figure 1, 


Figure 1. Closed walks of length 7 type 1.
Case 2: For the configuration of Figure 2, 


Figure 2. Closed walks of length 7 type 2.
Case 3: For the configuration of Figure 3, 


Figure 3. Closed walks of length 7 type 3.
Case 4: For the configuration of Figure 4, 


Figure 4. Closed walks of length 7 type 4.
Case 5: For the configuration of Figure 5(a), 


subgraphs of G that have the same configuration as the graph of Figure 5(b) and are counted in M. Thus


of Figure 5(b) and 6 is the number of times that this subgraph is counted in M. Let 
Thus

graph of Figure 5(c) and 2 is the number of times that this subgraph is counted in M. Let 
Thus

the graph of Figure 5(d) and 4 is the number of times that this subgraph is counted in M. Consequently,

Figure 5. Closed walks of length 7 type 5.
Case 6: For the configuration of Figure 6(a),


number of subgraphs of G that have the same configuration as the graph of Figure 6(b) and are counted in M.
Thus

the graph of Figure 6(b) and 2 is the number of times that this subgraph is counted in M. Consequently,

Figure 6. Closed walks of length 7 type 6.
Case 7: For the configuration of Figure 7, 


Figure 7. Closed walks of length 7 type 7.
Case 8: For the configuration of Figure 8(a), 

Let 
are counted in M. Thus

configuration as the graph of Figure 8(b) and 4 is the number of times that this subgraph is counted in M.
Consequently,
Figure 8. Closed walks of length 7 type 8.
Case 9: For the configuration of Figure 9(a), 


of subgraphs of G that have the same configuration as the graph of Figure 9(b) and are counted in M. Thus


Figure 9(b) and 2 is the number of times that this subgraph is counted in M. Consequently,

Figure 9. Closed walks of length 7 type 9.
Case 10: For the configuration of Figure 10, 


Figure 10. Closed walks of length 7 type 10.
Case 11: For the configuration of Figure 11(a), 


of subgraphs of G that have the same configuration as the graph of Figure 11(b) and are counted in M. Thus


of Figure 11(b) and 2 is the number of times that this subgraph is counted in M. Let 
Thus

the graph of Figure 11(c) and 6 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 11(d) and 6 is the number of times that this subgraph is counted in
M. Consequently,
Figure 11. Closed walks of length 7 type 11.
Now, we add the values of 

Example 1. In













by Theorem 12, the number of cycles of length 7 in 

3. Number of Cycles Passing the Vertex vi
In this section we give formulae to count the number of cycles of lengths 6 and 7, each of which contain a specific vertex 
Theorem 13. If G is a simple graph with n vertices and the adjacency matrix
6-cycles each of which contains a specific vertex 


cases that are considered below.
Proof: The number of 6-cycles each of which contain a specific vertex 



To find x, we have 17 cases as considered below; the cases are based on the configurations-(subgraphs) that generate 









Case 1: For the configuration of Figure 12, 


Figure 12. 
Case 2: For the configuration of Figure 13, 


Figure 13. 
Case 3: For the configuration of Figure 14, 


Figure 14. 
Case 4: For the configuration of Figure 15, 


Figure 15. 
Case 5: For the configuration of Figure 16, 


Figure 16. 
Case 6: For the configuration of Figure 17, 


Figure 17. 
Case 7: For the configuration of Figure 18, 


Figure 18. 
Case 8: For the configuration of Figure 19, 


Figure 19. 
Case 9: For the configuration of Figure 20, 


Figure 20. 
Case 10: For the configuration of Figure 21, 


Figure 21. 
Case 11: For the configuration of Figure 22(a), 


number of all subgraphs of G that have the same configuration as the graph of Figure 22(b) and are counted in
M. Thus

graph of Figure 22(b) and this subgraph is counted only once in M. Consequently,
Figure 22. 
Case 12: For the configuration of Figure 23(a), 


of all subgraphs of G that have the same configuration as the graph of Figure 23(b) and are counted in M. Thus


of Figure 23(b) and 2 is the number of times that this subgraph is counted in M. Consequently,

Figure 23. 
Case 13: For the configuration of Figure 24(a), 


of all subgraphs of G that have the same configuration as the graph of Figure 24(b) and are counted in M. Thus


of Figure 24(b) and this subgraph is counted only once in M. Consequently,
Figure 24. 
Case 14: For the configuration of Figure 25(a), 


of all subgraphs of G that have the same configuration as the graph of Figure 25(b) and are counted in M. Thus



Figure 25. 
Case 15: For the configuration of Figure 26(a), 

denote the number of all subgraphs of G that have the same configuration as the graph of Figure 26(b) and are
counted in M. Thus

configuration as the graph of Figure 26(b) and 2 is the number of times that this subgraph is counted in M. Consequently,
Figure 26. 
Case 16: For the configuration of Figure 27(a), 


all subgraphs of G that have the same configuration as the graph of Figure 27(b) and are counted in M. Thus


Figure 27(b) and 2 is the number of times that this subgraph is counted in M. Let 
M. Thus

the graph of Figure 27(c) and 2 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 27(d) and 2 is the number of times that this subgraph is counted in
M. Consequently,
Figure 27. 
Case 17: For the configuration of Figure 28(a), 


subgraphs of G that have the same configuration as the graph of Figure 28(b) and are counted in M. Thus



Figure 28. 
Now we add the values of 


Example 2. In the graph of Figure 29 we have,


Figure 29. Complete graph with 7 vertices.
Theorem 14. If G is a simple graph with n vertices and the adjacency matrix
7-cycles each of which contains a specific vertex 


cases that are considered below.
Proof: The number of 7-cycles each of which contains a specific vertex 



To find x, we have 30 cases as considered below; the cases are based on the configurations-(subgraphs) that generate 









Case 1: For the configuration of Figure 30, 


Figure 30. 
Case 2: For the configuration of Figure 31, 


Figure 31. 
Case 3: For the configuration of Figure 32, 


Figure 32. 
Case 4: For the configuration of Figure 33, 


Figure 33. 
Case 5: For the configuration of Figure 34, 


Figure 34. 
Case 6: For the configuration of Figure 35, 


Figure 35. 
Case 7: For the configuration of Figure 36, 


Figure 36. 
Case 8: For the configuration of Figure 37, 


Figure 37. 
Case 9: For the configuration of Figure 38(a), 


number of all subgraphs of G that have the same configuration as the graph of Figure 38(b) and are counted in
M. Thus

the graph of Figure 38(b) and this subgraph is counted only once in M. Consequently,

Figure 38. 
Case 10: For the configuration of Figure 39(a), 


number of all subgraphs of G that have the same configuration as the graph of Figure 39(b) and are counted in
M. Thus

the graph of Figure 39(b) and this subgraph is counted only once in M. Consequently,

Figure 39. 
Case 11: For the configuration of Figure 40(a), 


subgraphs of G that have the same configuration as the graph of Figure 40(b) and are counted in M. Thus


of Figure 40(b) and 2 is the number of times that this subgraph is counted in M. Consequently,

Figure 40. 
Case 12: For the configuration of Figure 41(a), 


subgraphs of G that have the same configuration as the graph of Figure 41(b) and are counted in M. Thus


of Figure 41(b) and 2 is the number of times that this subgraph is counted in M. Let 
M. Thus

the graph of Figure 41(c) and 2 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 41(d) and 2 is the number of times that this subgraph is counted in
M. Consequently,
Figure 41. 
Case 13: For the configuration of Figure 42(a), 


number of all subgraphs of G that have the same configuration as the graph of Figure 42(b) and are counted in
M. Thus

the graph of Figure 42(b) and 2 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 42(c) and 2 is the number of times that this subgraph is counted in M. Let 
42(d) and are counted in M. Thus

the same configuration as the graph of Figure 42(d) and 2 is the number of times that this subgraph is
counted in M. Consequently,
Figure 42. 
Case 14: For the configuration of Figure 43(a), 


subgraphs of G that have the same configuration as the graph of Figure 43(b) and are counted in M. Thus


of Figure 43(b) and 2 is the number of times that this subgraph is counted in M. Let 
M. Thus

the graph of Figure 43(c) and this subgraph is counted only once in M. Let 


of Figure 43(d) and 2 is the number of times that this subgraph is counted in M.
Consequently,
Figure 43. 
Case 15: For the configuration of Figure 44(a), 


of all subgraphs of G that have the same configuration as the graph of Figure 44(b) and are counted in M. Thus


of Figure 44(b) and 2 is the number of times that this subgraph is counted in M. Let 
M. Thus

the graph of Figure 44(c) and 2 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 44(d) and 2 is the number of times that this subgraph is counted in M. Let 
44(e) and are counted in M. Thus

same configuration as the graph of Figure 44(e) and 1 is the number of times that this subgraph is counted in
M. Consequently,
Figure 44. 
Case 16: For the configuration of Figure 45(a), 


number of all subgraphs of G that have the same configuration as the graph of Figure 45(b) and are counted in
M. Thus

the graph of Figure 45(b) and 2 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 45(c) and 1 is the number of times that this subgraph is counted in M.
Consequently,
Figure 45. 
Case 17: For the configuration of Figure 46(a), 


number of all subgraphs of G that have the same configuration as the graph of Figure 46(b) and are counted in
M. Thus

the graph of Figure 46(b) and 2 is the number of times that this subgraph is counted in M. Consequently,

Figure 46. 
Case 18: For the configuration of Figure 47(a), 

denotes the number of all subgraphs of G that have the same configuration as the graph of Figure 47(b) and are
counted in M. Thus

configuration as the graph of Figure 47(b) and 1 is the number of times that this subgraph is counted in M.
Consequently,
Figure 47. 
Case 19: For the configuration of Figure 48, 


Figure 48. 
Case 20: For the configuration of Figure 49(a), 

Theorem 5). Let 
Figure 49(b) and are counted in M. Thus

have the same configuration as the graph of Figure 49(b) and 2 is the number of times that this subgraph is
counted in M. Consequently,
Figure 49. 
Case 21: For the configuration of Figure 50(a), 

Let 
and are counted in M. Thus

same configuration as the graph of Figure 50(b) and 2 is the number of times that this subgraph is counted in M. Let 
and are counted in M. Thus

the same configuration as the graph of Figure 50(c) and 2 is the number of times that this subgraph is counted in M.
Consequently,
Figure 50. 
Case 22: For the configuration of Figure 51(a), 

7). Let 
51(b) and are counted in M. Thus

the same configuration as the graph of Figure 51(b) and 2 is the number of times that this subgraph is counted in M. Let 
Figure 51(c) and are counted in M. Thus

have the same configuration as the graph of Figure 51(c) and 6 is the number of times that this subgraph is counted in M. Let 
of Figure 51(d) and are counted in M. Thus

that have the same configuration as the graph of Figure 51(d) and 1 is the number of times that this subgraph is counted in M. Let 
of Figure 51(e) and are counted in M. Thus

that have the same configuration as the graph of Figure 51(e) and 2 is the number of times that this subgraph is counted in M. Let 
graph of Figure 51(f) and are counted in M. Thus

of G that have the same configuration as the graph of Figure 51(f) and 1 is the number of times that this subgraph is counted in M. Consequently,

Figure 51. 
Case 23: For the configuration of Figure 52(a), 

Let 
and are counted in M. Thus

same configuration as the graph of Figure 52(b) and 2 is the number of times that this subgraph is counted in M. Let 
and are counted in M. Thus

the same configuration as the graph of Figure 52(c) and 1 is the number of times that this subgraph is counted in M. Consequently,

Figure 52. 
Case 24: For the configuration of Figure 53(a), 
(See Theorem 11). Let 


Figure 53. 
Case 25: For the configuration of Figure 54(a), 


the number of all subgraphs of G that have the same configuration as the graph of Figure 54(b) and are counted
in M. Thus

the graph of Figure 54(b) and 2 is the number of times that this subgraph is counted in M. Let 
in M. Thus

as the graph of Figure 54(c) and 1 is the number of times that this subgraph is counted in M. Consequently,
Figure 54. 
Case 26: For the configuration of Figure 55(a), 

denote the number of all subgraphs of G that have the same configuration as the graph of Figure 55(b) and are
counted in M. Thus

configuration as the graph of Figure 55(b) and 1 is the number of times that this subgraph is counted in M. Let 
55(c) and are counted in M. Thus

same configuration as the graph of Figure 55(c) and 1 is the number of times that this subgraph is counted in M. Consequently,
Figure 55. 
Case 27: For the configuration of Figure 56(a), 


number of all subgraphs of G that have the same configuration as the graph of Figure 56(b) and are counted in
M. Thus

the graph of Figure 56(b) and 1 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 56(c) and 2 is the number of times that this subgraph is counted in M. Let 
56(d) and are counted in M. Thus

the same configuration as the graph of Figure 56(d) and 2 is the number of times that this subgraph is counted in M. Let 
Figure 56(e) and are counted in M. Thus

have the same configuration as the graph of Figure 56(e) and 2 is the number of times that this subgraph is counted in M. Let 
of Figure 56(f) and are counted in M. Thus

that have the same configuration as the graph of Figure 56(f) and 2 is the number of times that this
subgraph is counted in M. Consequently,
Figure 56. 
Case 28: For the configuration of Figure 57(a), 


of all subgraphs of G that have the same configuration as the graph of Figure 57(b) and are counted in M. Thus


of Figure 57(b) and 1 is the number of times that this subgraph is counted in M. Let 
M. Thus

denote the number of all subgraphs of G that have the same configuration as the graph of Figure 57(d) and are
counted in M. Thus

configuration as the graph of Figure 57(d) and 3 is the number of times that this subgraph is counted in M. Let 
57(e) and are counted in M. Thus

the same configuration as the graph of Figure 57(e) and 2 is the number of times that this subgraph is
counted in M. Consequently,
Figure 57. 
Case 29: For the configuration of Figure 58(a), 


the number of all subgraphs of G that have the same configuration as the graph of Figure 58(b) and are counted
in M. Thus

as the graph of Figure 58(b) and 1 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 58(c) and 4 is the number of times that this subgraph is counted in M. Let 
58(d) and are counted in M. Thus

the same configuration as the graph of Figure 58(d) and 4 is the number of times that this subgraph is counted in M. Let 
Figure 58(e) and are counted in M. Thus

have the same configuration as the graph of Figure 58(e) and 1 is the number of times that this subgraph is counted in M. Let 
of Figure 58(f) and are counted in M. Thus

that have the same configuration as the graph of Figure 58(f) and 2 is the number of times that this subgraph is counted in M. Consequently,
Figure 58. 
Case 30: For the configuration of Figure 59(a), 


all subgraphs of G that have the same configuration as the graph of Figure 59(b) and are counted in M. Thus


Figure 59(b) and 1 is the number of times that this subgraph is counted in M. Let 
Thus

graph of Figure 59(c) and 1 is the number of times that this subgraph is counted in M. Let 
in M. Thus

as the graph of Figure 59(d) and 3 is the number of times that this subgraph is counted in M. Let 
counted in M. Thus

configuration as the graph of Figure 59(e) and 2 is the number of times that this subgraph is counted in
M. Consequently,
Figure 59. 
Now, we add the values of 


Example 3 In the graph of Figure 29 we have,


Cite this paper
Nazanin Movarraei,Samina A. Boxwala, (2016) On the Number of Cycles in a Graph. Open Journal of Discrete Mathematics,06,41-69. doi: 10.4236/ojdm.2016.62005
References
- 1. Harary, F. and Manvel, B. (1971) On the Number of Cycles in a Graph. Mat. Casopis Sloven. Akad. Vied, 21, 55-63.
- 2. Chang, Y.C. and Fu, H.L. (2003) The Number of 6-Cycles in a Graph. Bulletin of the ICA, 39, 27-30.
- 3. Alon, N., Yuster, R. and Zwick, U. (1997) Finding and Counting Given Length Cycles. Algorithmica, 17, 209-223.
http://dx.doi.org/10.1007/BF02523189 - 4. Bjorklund, A., Husfeldt, T., Kaski, P. and Koivisto, M. (2009) Counting Paths and Packing in Halves. Lecture Notes in Computer Science, 5757, 578-586.
http://dx.doi.org/10.1007/978-3-642-04128-0_52 - 5. Bjorklund, A., Husfeldt, T., Kaski, P. and Koivisto, M. (2008) The Fast Intersection Transform with Applications to Counting Paths, CoRR, abs/0809.2489.
- 6. Chen, J., Lu, S., Sze, S.H. and Zhang, F. (2007) Improved Algorithms for Path, Matching and Packing Problems. 18th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2007), Philadelphia, 298-307.
- 7. Koutis, I. (2008) Faster Algebraic Algorithm for Path and Packing Problems. CALP, LNCS 5125, 575-586. Springer, Berlin.
- 8. Kroese, D.P. and Roberts, B. (2007) Estimating the Number of s-t Paths in a Graph. Journal of Graph Algorithms and Applications, 11, 195-214.
http://dx.doi.org/10.7155/jgaa.00142 - 9. Williams, R. (2009) Finding a Path of Length k in O*(2K)Time. Information Processing Letters, 109, 315-318.
http://dx.doi.org/10.1016/j.ipl.2008.11.004 - 10. Boxwala, S.A. and Movarraei, N. (2015) On the Number of Paths of Length 5 in a Graph. International Journal of Applied Mathematical Research, 4, 30-51.
http://dx.doi.org/10.14419/ijamr.v4i1.3874 - 11. Movarraei, N. and Shikare, M.M. (2014) On the Number of Paths of Lengths 3 and 4 in a Graph. International Journal of Applied Mathematical Research, 3, 178-189.
- 12. Boxwala, S.A. and Movarraei, N. (2015) On the Number of Paths of Length 6 in a Graph. International Journal of Applied Mathematical Research, 4, 267-280.
http://dx.doi.org/10.14419/ijamr.v4i2.4314
























































































































