Algorithm for Constructing Total Graph of Commutative Ring

ABSTRACT


A. INTRODUCTION
Mathematics is a science that is widely studied and applied in various fields.Mathematics is very closely related to the way of thinking of someone who can influence life.The rapid development of information and communication technology is based on the development of mathematics in analysis, number theory, probability theory, algebra, and discrete mathematics.Discrete mathematics is a branch of mathematics that studies all discrete things.One branch of the discussion of discrete mathematics namely graph theory.Graph theory has a long history in mathematics, originating from the Seven Konigsberg Bridges problem, which was proven by Leonhard Euler in 1736 (Mir, 2014).Graph  is a pair (, ) where  is a finite set and nonempty of objects called vertices, and  is a set (can be empty) unordered pairs of distinct vertices  , which are called edges (Akbari et al., 2009).The set of vertices and edges in a sequential graph  can be denoted by  () and ().Graph  which is not having edges is said to be an empty graph.Graph  is called a connected graph if a path is found for each pair of different vertices in .The girth of , denoted by (), is shortest cycle length in .
Graph theory has become an essential mathematical tool across various subjects recently.Graphs can also be obtained from algebraic structures in groups and rings.Beck (1988) was the first to introduce graph theory in relation to the ring.Several graphs were obtained of ring algebraic structures, including zero-divisor graphs over a commutative ring (Anderson & Lewis, 2016), the unit graph of a non-commutative ring (Akbari et al., 2015), the generalized total graph of a commutative ring (Anderson & Badawi, 2013), the annihilator graph of a commutative ring (Nikmehr et al., 2017), and the total zero-divisor graph of commutative rings (Đurić et al., 2018).Ring  is a non-empty set  which contains two binary operations viz addition and multiplication that satisfy the abelian group properties for operations addition, closed for multiplication, associative for multiplication, and the multiplication operation is distributive to the addition operation.Let  be a commutative ring.In (2008), Anderson and Badawi introduced the total graph of , denoted by (()) is a graph whose set of vertices is all members of the ring  and for each different ,  ∈  will be adjacent if and only if  +  ∈ () where () is the set of zero-divisors in  and in line with (Akbari et al., 2009) in this paper we assume that 0 ∈ ().
In this paper, the ring used is a ring of integer modulo .A ring of integer modulo  is denoted by ℤ  .Some researchers have also studied a graph with ring of integer modulo , as in (Basak et al., 2019), (Mishra & Patra, 2020), and (Ju et al., 2014).In (2021), Any and Hidayah have researched the girth of the total graph of ℤ , denoted by (  (ℤ  )).Kalita et al. (2014) introduce the prime graph of the commutative Ring ℤ , .Prime graph is a graph associated with a ring denoted ().() is defined as the graph whose vertices are elements of a ring  and any two vertices  and  of  are adjacent if and only if  = 0 or  = 0.The vertex degree of vertex  on graph  is denoted by () is the number of vertices adjacent to  in graph  (Akbari et al., 2009).Several researchers have researched total graphs, including (Anderson & Badawi, 2008), (Akbari et al., 2009), and (Mondal et al., 2023).Anderson and Weber (2018) investigated zero-divisor graphs of  , where  contains no identities.By modifying the definition of zero-divisor graphs, relationships between zero-divisor graphs and commutative rings has increased greatly interest among scholars (Aalipour & Akbari, 2016).
Python is a versatile widely used programming language renowned for its simplicity and readability.Python is well renowned for being straightforward and adaptable, making it a popular choice for a variety of applications (Tangirov & Rakhimov, 2023).The Python programming language was created with the aim of making it easier to read code from productivity and writing syntax in higher level development.Python was created by Guido van Rossum in the late 1980s and early 1990s at the National Research Institute for Mathematics and Computer Science in Netherlands (Saabith et al., 2019).In the graphic concept of ring, several researchers have used python algorithms such as in (Tapanyo et al., 2022), (Kansal et al., 2022), (Hartati & Kurniawan, 2023), and (Tian & Li, 2022).In previous research, no algorithm was given to construct the total graph.This paper aims to determine an algorithm for constructing the total graph of ring ℤ  using Python and determine the properties of the graph.In this paper we creating an algorithm to construct total graphs from commutative rings streamlines the construction process, enhances accessibility and utilization of total graphs, and supports parameter variation exploration and application in problem-solving.The first section of this paper is the introduction.Then the algorithm constructs a graph.An example of how the algorithm works is given, and the last section is the conclusion of this discussion.

B. METHODS
This method used in this research is a literature studies by collecting and reviewing various references related to be research topics such as graph theory, structure of algebra, Python programming, and the total graph of a commutative ring.The steps taken in this research are as follows.
a. Learning basic definitions and theorems related to graph theory and stucture of algebra.b.Create an algorithm for constructing the total graph of the ring of integers modulo  with Python.c. Investigating the properties of the total graph of the ring of integers modulo .d.Making conclusions.
In general, the research procedure is presented in Figure 1.The following explains several definitions that underlie this research, include the basic concepts of graphs, rings, dan the total graph of a commutative ring.

Basic Concepts of Graphs
The definitions of basic graph concepts discussed below refer to Chartrand et al. (2016).and  2 are adjacent because there is  1 which connects them, while  3 and  4 are not adjacent.
Then edge  1 is called incident with vertices  1 and  2 .
Definition 2.2.The degree of a vertex  in a graph , denoted (), is the number of proper edges incident on  plus twice the number of self-loops.
Definition 2.3.A  −  walk in a graph  is a finite sequence of vertices starting with vertex  and ends at vertex , where the vertices in the sequence are adjacent.
Definition 2.4.A  −  walk on a graph  that does not contain repeated vertices is called a  −  path.For example, consider the graph  1 in Figure 2 sequence Definition 2.11.The girth of a graph  is the length of the shortest cycle in graph .

Basic Concepts of Ring
The definitions of basic ring concepts discussed below refer to Adhikari & Adhikari (2014).Definition 2.13.The non-zero element  in the ring  is said to be a left (right) zero-divisor iff ∃ a non-zero element  ∈  such that  = 0 ( = 0).The zero-divisor is an element of  which is the left and a right zero-divisor i.e., the zero-divisor is the element  which divides 0.

The Total Graph of Commutative Ring
The definitions of total graph of commutative ring discussed below refer to Anderson & Badawi (2008).
Definition 2.14.Let  be a commutative ring.The total graph of , denoted by (()) is a graph whose set of vertices is all members of the ring  and for each different ,  ∈  will be adjacent if and only if  +  ∈ () where () is the set of zero-divisors in .Example 1.The following is an example is an example of ((ℤ 6 )) where ℤ 6 = {0,1,2,3,4,5}.
By definition, the vertex set of ((ℤ 6 )) is all members of the ring ℤ 6 = {0,1,2,3,4,5}.For all ℤ 6 elements, check if there is a positive integer  such that  = 0. Based of Table 1, we have a zero divisor elemen in ring (ℤ 6 ) = {0,2,3,4}.Then, for each different ,  ∈ ℤ 6 , will be adjacent if and only if  +  ∈ (ℤ 6 ).The total graph of ℤ 6 is shown in Figure 3.The first algorithm to construct a total graph on a ℤ  integer ring is parameterized by a zero-divisor.The recursive algorithm is called TotalGraph.Then import the library for drawing graphs in Python.The following defines a total graph.Import library networkx and mathplotlib.pyplotfirst.In step 1, the algorithm looks for the zero-divisor elements of ℤ  .For all ℤ  elements, check if there is a positive integer  such that  = 0.If there is, then  is a zero-divisor element of ℤ  , add  to (ℤ  ).However, if no b satisfies the condition, it returns to the looping process in step 1. Next, during step 2, determine the set of vertices ((ℤ  )).For all  ∈ ℤ  , add  to ((ℤ  )) as a vertex.Afterward, the algorithm verifies the adjacency between vertices.For ,  ∈ ((ℤ  )), if  ≠ , then continue.Otherwise, it reverts to the looping process in step 2. If  +  ∈ (ℤ  ), then,  and  are adjacent.Otherwise, it reverts to the looping process in step 2. At this point, we have acquired the set of vertices ((ℤ  )) and the set of edge ((ℤ  )).Lastly, in step 3, draw the total graph of ℤ  .
However, in this case, there is only one vertex, the condition can't be fulfilled.As a result, the looping process in this step concludes and the algorithm moves on to step 3 to draw the total graph.For  = 2, we have ℤ 1 = {0,1}.In step 1, the algorithm checks for zero-divisor elements, that is, if ,  ∈ ℤ 2 , if there exists a positive integer  in such way that  = 0, then add  to (ℤ 2 ).At this point, we have (ℤ 2 ) = {0}.Then, in step 2, determines ((ℤ 2 )).
As there remains an unexplored vertex ((ℤ 6 )), the program will loop back to the process.Through the looping process, adjacencies between different vertices are identified.As a result, the looping process in this step concludes and the algorithm moves on to step 3 to draw the total graph of ℤ 6 .
For ,  ∈ ((ℤ 12 )), if  ≠ , then continue.Next, we will check whether  +  ∈ (ℤ  ), then,  and  are adjacent.It's found when  = 2 ,  = 4 , so that  +  = 6 ∈ (ℤ 12 ) .Because the conditions are met, vertices 2 and 4 are adjacent.Upon resuming the looping process, it is discovered that  = 2 ,  = 6 , so that  +  = 8 ∈ (ℤ 12 ) .Because the conditions are met, vertices 2 and 6 are adjacent.As there remains an unexplored vertex ((ℤ 12 )), the program will loop back to the process.Through the looping process, adjacencies between different vertices are identified.As a result, the looping process in this step concludes and the algorithm moves on to step 3 to draw the total graph of ℤ 12 .

D. CONCLUSION AND SUGGESTIONS
In this paper, we have defined a total graph of ring  and described the algorithm for constructing a total graph using Python.Some examples of how the GraphTotal algorithm for working in ring ℤ  has been given.Observational results of the properties from total graph of ring ℤ  have been shown.The results of these observations are useful as assumptions about the properties that apply to the total graph of ring ℤ  .Finally, GraphTotal algorithm to constructing ((ℤ  )) using the Python program is very useful because it takes only a short time to construct the graph.In future research, it is hoped that future researchers can study algorithms for constructing other graphs or graphs on other rings.

Figure 1 .
Figure 1.Research procedure chart Definition 2.1.A graph  is a finite non-empty set  containing objects called vertices (the singular from is vertex) and a possibly empty set  which consists of two element subsets of  called edges.The order of a graph  is represented by the symbols |()| for the number of vertices and |()| for the number of edges.As an example, below is an illustration of graph  1 .

Figure 8 .
Figure8is the result of the construction of the total graph of ℤ 2  , for  = 2,3.The total graph of ℤ 4 consists of 4 vertices and 2 edges, while the total graph of ℤ 8 consists of 8 vertices and 12 edges.Because the graph is devided into two components with each vertex in each component always connected by an edge, then for  = 2,3, (ℤ 2  ) is a disconnected graph consisting of two components, where each component is a complete graph.f.Example 3.6.Finally, an example for the high-order case  is shown, and can be observed in an easy way to construct a total graph using an algorithm while taking the processing time of the program into account.

Figure 9 .
Figure 9.Total Graph of ℤ  for greater integer values of 3 is a path because it doesn't repeat any vertex.
Definition 2.5.A graph  is connected if every two vertices  and  of , there is a  −  path.Definition 2.6.A empty graph is a graph whose size 0. Definition 2.7.A complete graph is a simple graph where any two distinct vertices are adjacent.Definition 2.8.A regular graph  is a graph whose vertices in  have the same degree.Definition 2.9.A cycle in  that passes through all vertices in  exactly once is called a Hamiltonian cycle of .Definition 2.10.A Hamiltonian graph of  is a connected graph that contains the Hamiltonian cycle.