This document presents MATLAB programs to calculate the energy of simple graphs including cycles, wheels, and cyclic cubic graphs. The energy of a graph is defined as the sum of the absolute values of its eigenvalues. Algorithms are provided to generate MATLAB functions to calculate the energy for these graph types by generating the adjacency matrix and computing its eigenvalues. Examples applying the functions to cycles and wheels with n=40 and n=23 are shown. The programs make calculating graph energy for large values of n straightforward.
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Energy of Some Simple Graphs: MATLAB Approach
1. Energy of Some Simple Graphs: MATLAB
Approach
1
Sweta Srivastav,2
Sangeeta Gupta, ∗
Abstract—In the present paper we have investigated
MATLAB program to find the energy of the graph.
The energy of the Graph E(G) of G is the sum of
absolute value of its eigen values. There are many
research on energy of the graph, we have investigated
the very new MATLAB program for finding energy of
cycle, wheel and cyclic cubic graphs for n values and
we consider example of all the graph for n ≥ 20.
Keywords: MATLAB program, Energy Graph, cy-
cle,wheel , cyclic cubic graph
1 Introduction
In the present paper we consider simple,finite and
undirected graph, for standard terminology and notation
we follow R.Balakrishnan,K.Rangnanthan [2].while for
some terminology we follow R.Balakrishnan [1].In 1978
I.Gutman [3] defined the energy of a graph G as the
sum of absolute values of the eigen value of graph G and
denoted it by E(G)i.e E(G) =
n
i=1 |λi|.
Here we have investigated the MATLAB program
for finding the energy of some simple graph in general-
ized form with the help of these program we can achieve
the result without any efforts for any value of n.
2 Algorithms:
Algorithm 2.1: To generate the MATLAB programme
for finding the energy of cycle for n ≥ 3.
Open MATLAB Editor window and write the following
program and the program will save as the function file,
we use plotcycle here. Generate Cn by entering the
value of n, we will get our cycle Cn. Then by run the
programe we achive the energy of Cn. The programe is
as follows:
function[Energy] = plotcycle(n)
% To write the program to find the energy of cycle.
% v be the number of vertices.
% e be the number of edges.
% ’A’ will give you Adjacency Matrix.
∗Sharda University, Greater Noida,India.Email:
sweta.srivastav@sharda.ac.in, sangeeta.gupta@sharda.ac.in
% ’K’ results Eigen Values.
% ’E’ results Energy of the graph.
v = [1 : n];
e = [2 : n, 1];
G = graph(v, e);
A = adjacency(G);
B = full(A);
K = eig(B);
E = sum(abs(K))
plot(G)
title([ Cyclicgraphforn = , num2str(n)])
gtext([ EnergyofGraph = , num2str(E)])
To illustrate above program see below example. In
command window write plotcycle(40), then press
enter, the output will be E=50.8248.
Figure 1: cycleC40
Algorithm 2.2: To generate the Matlab program for
finding the energy of wheel graph Wn.
Open MATLAB Editor window and write the fol-
lowing program and the program will save as the
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 9, September 2017
7 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
2. function file, we use plotwheel here. Generate Wn by
entering the value of n, we will get our wheel Wn. Then
by run the program we achive the energy of Wn. The
program is as follows:
function[energy] = plotwheel(n)
% v be the number of vertices.
% e be the number of edges.
% ’A’ will give you Adjacency Matrix.
% ’K’ results Eigen Values.
% ’E’ results Energy of the graph.
v = [2 : n];
e = [3 : n, 2];
G = graph(v, e);
F = addedge(G, 1, 2 : n);
A = adjacency(F );
B = full(A);
K = eig(B);
E = sum(abs(K))
plot(F )
title([ W heelgraphforn = , num2str(n)])
gtext([ EnergyofGraph = , num2str(E)])
To illustrate above program see below example. In
command window write plotwheel(23), then press
enter, the output will be E=35.6984.
Figure 2: wheelW23
Algorithm 2.3: To generate the MATLAB program for
finding the energy of cycle 3-regular graph (Cyclic cubic
graph).
Open MATLAB Editor window and write the fol-
lowing program and the program will save as the
function file, we use plotcyclecubic here.
Generate cycle 3-regular graph by entering the value of
n, we will get cycle 3-regular graph .
Then by run the program we achive the energy of cycle
3-regular graph. The program is as follows:
function[energy] = plotcyclecubic(n)
% v be the number of vertices.
% e be the number of edges.
% ’A’ will give you Adjacency Matrix.
% ’K’ results Eigen Values.
% ’E’ results Energy of the graph.
v = [1 : n];
e = [2 : n, 1];
g = graph(v, e);
F = addnode(g, n);
H = addedge(F, 1 : n, n + 1 : 2 ∗ n);
I = addedge(H, [n+1 : 2∗n], [n+2 : 2∗n, n+1]);
A = adjacency(I);
B = full(A);
K = eig(B);
E = sum(abs(K))
plot(I)
title([ CyclicCubicgraphforn = , num2str(n)])
gtext([ EnergyofGraph = , num2str(E)])
To illustrate above program see below example. In
command window write plotcyclecubic(23), then
press enter, the output will be E=66.0814.
Figure 3: cyclic cubic graph 23
.
3 Conclusions and Future Work
The program proved here to find the energy of the
graph is very easy task for any big value of n.The
energy of a graph is one of the emerging concept within
graph theory.The energy of many graph is known, to
investigate the similar program, is the open research area.
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 9, September 2017
8 https://sites.google.com/site/ijcsis/
ISSN 1947-5500
3. References
[1] R.Balakrishnan, The enrgy of a graph,Lin. algebra
Appl. 387(2004), 287-295.
[2] R.Balakrishnan,K.Ranganathan, A textbook of
graph theory, Springer, Newn york, 2000.
[3] I.Gutman, The energy of a graph, Ber. Math.
Statist.Sekt.Forschungsz. Graz 103(1978) 1-22.
[4] J. Gross and J. Yellen, Graph Theory and its appli-
cations,CRC Press.
[5] F. Harary, Graph Theory, Addition-Wesley, Reading
Mass,1972.
[6] J. A. Gallian, A dynamic survey of graph labeling,
Electronic Journal of Combinatorics, (2010), DS6.
[7] G.S.Bloom and S.W.Golomb, Applications of
numbered undirected graphs, Proceedings of IEEE,
165(4)(1977), 562-570.
[8] J.A Bondy, U.S.R Murty Graph Theory with Appli-
cations,The MacMillan Press Ltd (1976).
[9] S Lang,Algebra,Addison-Wesley (1993).
[10] H.B Walikar, I Gutman, P.R Hampiholi, H.S
Ramane, Graph Theory Notes New York Acad. Sci., 41
(2001), pp. 14-16.
[11] Stephen J. Chapman, MATLAB programming for
engineers, Chris Carson, Thomson Corporation(2008).
International Journal of Computer Science and Information Security (IJCSIS),
Vol. 15, No. 9, September 2017
9 https://sites.google.com/site/ijcsis/
ISSN 1947-5500