Algorithm for Visualization of Zero Divisor Graphs of the Ring ℤn Using MAPLE Coding


This research investigates the comparative efficacy of generating zero divisor graphs (ZDGs) of the ring of integers ℤn modulo n using MAPLE algorithm. Zero divisor graphs, pivotal in the study of ring theory, depict relationships between elements of a ring that multiply to zero. The paper explores the development and implementation of algorithms in MAPLE for constructing these ZDGs. The comparative study aims to discern the strengths, limitations, and computational efficiency of different MAPLE algorithms for creating zero divisor graphs offering insights for mathematicians, researchers, and computational enthusiasts involved in ring theory and mathematical computations.

Share and Cite:

Ali, N. (2024) Algorithm for Visualization of Zero Divisor Graphs of the Ring ℤn Using MAPLE Coding. Open Journal of Discrete Mathematics, 14, 1-8. doi: 10.4236/ojdm.2024.141001.

1. Introduction

Graph theory has various applications in different fields [1] [2] . It is used to model interactions between individuals in social networks and optimize routes in transportation systems. Graph analysis is beneficial for computer networks as it ensures data flow and connectivity. Electrical circuits can be better understood through graph representations, which aid in their design. In biology, graphs are used to depict protein interactions and genetic patterns. Epidemiology utilizes graphs to track the spread of diseases, while recommendation systems use them to suggest products online. Graphs are also used to model molecular structures in chemistry and optimize search engines. In strategic scenarios, game theory benefits from graph analysis.

Graph theory also intersects with algebra, leading to the development of algebraic graph theory. This area of study investigates the relationships between graphs and algebraic structures such as groups and matrices. Cayley graphs, for example, provide insights into the symmetries of groups. Spectral graph theory explores graph properties using eigenvalues and eigenvectors [3] . Combinatorial optimization addresses problems such as maximal cliques and minimal spanning trees. Algebraic techniques, including graph theory, are helpful in designing error-correcting codes. Additionally, polynomials can be represented through graph-based interpolation [4] [5] .

Coding theory combines algebraic codes and graphs to identify and fix errors in data transmission. Representation theory investigates the connection between algebraic structures and graphs [6] . Homological algebra examines the homology and cohomology of algebraic structures using graphs. Algebraic geometry benefits from graph representation, allowing for a visual understanding of algebraic varieties [7] . The interplay between graph theory and algebra is crucial in various theoretical and practical situations [8] [9] [10] [11] .

Readers may see [12] [13] [14] [15] to read many advantages of studying CZDG over the earlier studied ZDG. For example, in any ring R having at least 2 vertices, there exists no finite regular CZDG [3] (Proposition 1.10). Further, Anderson et al. [3] showed that the CZDG of local ring R is isomorphic to a star graph with a minimum of 4 vertices (If a ring has a unique maximal ideal, then it is called local ring). Pirzada (2012) provides an introductory exploration into the field of graph theory [16] . Pirzada, Raja, and Redmond (2014) delve into the concept of locating sets and numbers of graphs in association with commutative rings [17] . Pirzada and Raja (2016) present a study on graphs linked with modules over commutative rings [18] . Pirzada and Raja (2017) investigate the metric dimension of a zero divisor graph in their paper published in Communications in Algebra [19] . Recently, Pirzada, Raja, and Redmond (2016) [20] have developed some algorithms using C++ language for constructing ZDGs of commutative rings. These algorithms were recursive in nature and constructed the graph for a given ring from sub-graphs, which themselves were ZDGs of rings of smaller orders [21] . The drawback of using these algorithms is that it results in Beck’s ZDG [7] , which was later on replaced by Anderson and Livingston’s zero-divisor graph [3] . Now, the recent advancements show that the study of Anderson and Livingston ZDG is a matter of importance to characterize the rings based on their ZDGs. Redmond [22] expanded the ZDG idea from unital commutative rings to noncommutative rings. Some applications of graphs can be seen in [23] . Different methods were presented by him to characterize the ZDG related to a noncommutative ring, encompassing both undirected and directed graphs. Beck [8] proposed the connection between graph theory and algebra by introducing a ZDG of a commutative ring (CR) R. The author’s [8] primary focus was on the coloring of nodes in a graph, specifically on the ring elements that corresponded to these nodes. Note that, a zero vertex is linked to all other vertices in this case. Let the set of zero divisors (ZDs) be denoted by Z(R) for a CR R and the set of non-zero ZD of a CR R with 1 ≠ 0 is denoted by Z ( R ) = Z ( R ) \ { 0 } . In [3] , Anderson and Livingston conducted a study on a ZDG, in which each node represents a nonzero zero divisor. Let x , y Z ( R ) , then an undirected graph obtained by considering and y as vertices forming an edge if xy = 0 is called a ZDG of R, denoted Γ(R). The study of Anderson and Livingston emphasizes the case of finite rings, as finite graphs can be obtained when R is finite. Their task was to determine whether a graph is complete for a given ring or a star for a given ring. This ZDG definition differs slightly from Beck’s ZDG definition for R. Remember, zero is not considered as a vertex of ZDG in this case. The study of ZDG has been extinct in recent years and the idea has been explored that leads us to new form of ZDG that includes ideal-based ZDG and module-based ZDG [15] [20] . Redmond extended this work using a ZDG for a CR and transformed it into an ideal-based ZDG. The aim was to generalize the method by substituting elements with zero products with elements whose product belongs to a particular ideal I of ring R.

Mulay’s [15] work inspired us to study the ZDG obtained by considering equivalence classes of ZD of a ring R. This type of ZDG is called compressed zero-divisor graph (CZDG), denoted by Γ E ( R ) [4] . A CZDG is an undirected graph obtained by considering Z ( R E ) \ { [ 0 ] } = R E \ { [ 0 ] , [ 1 ] } as vertex set, and can be constructed by taking the equivalence classes [ x ] = { y R : a n n ( x ) = a n n ( y ) } , for every x R \ ( [ 0 ] [ 1 ] ) as vertices and and edge is formed between two distinct classes [ x ] and [ y ] if [ x ] [ y ] = 0 , i.e. if x y = 0 . It is important to note that if two vertices say and are adjacent in Γ(R) then in CZDG, [ x ] and [ y ] are adjacent if [ x ] [ y ] . Clearly, [ 1 ] = R \ Z ( R ) and [ 0 ] = { 0 } , also for each x R \ ( [ 0 ] [ 1 ] ) , [ x ] Z ( R ) \ { 0 } . Readers may study [5] for some interesting results on CZDG.

Within the realm of abstract algebra, the exploration of algebraic structures known as rings is a fundamental pursuit, and at the core of these structures lies the ring of integers, n . In mathematics, the study of zero divisors within n holds a paramount place, as these elements, when multiplied, result in zero. To visualize and comprehend the intricate relationships among these zero divisors, zero divisor graphs stand as a crucial tool, providing a graphical representation of these associations within the n structure.

This research embarks on a comparative analysis of various algorithms implemented in MAPLE for the construction of zero divisor graphs within n . Such a comparative investigation is particularly noteworthy due to the pivotal role these graphs play in unraveling the characteristics and behaviours of n , and their applications across diverse mathematical domains. The primary goal is to evaluate the efficiency and accuracy of a range of MAPLE algorithms in generating zero divisor graphs while considering different values of n.

Exploring these varied MAPLE algorithms is poised to offer valuable insights into their computational intricacies, effectiveness, and potential constraints. The study aims to present mathematicians, researchers, and enthusiasts in the computational realm with a comparative overview of these approaches, shedding light on the methodologies used to construct zero divisor graphs within n . This inquiry seeks to uncover the strengths and weaknesses inherent in these algorithms, fostering a deeper comprehension of the available methods for creating zero divisor graphs within the n domain. Furthermore, this investigation aims to contribute to the enhancement and refinement of computational tools and techniques applied in the domain of ring theory, thereby advancing broader mathematical inquiries.

Novelty: Based on the cited literature, creating zero-divisor graphs for large values of in the ring of integers n modulo n can be quite challenging. However, our article offers a solution. The research presented in this article introduces a novel approach to constructing zero divisor graphs within the ring of integers n modulo n. This work stands as a unique and pioneering contribution, offering a distinct methodology for the creation of these essential mathematical graphs. The innovation lies in the development of algorithms using MAPLE, enabling the generation of zero divisor graphs to visualize and comprehend the relationships between zero divisors within the n modular arithmetic structure.

The novelty of this study resides in the comparative analysis of these algorithms, marking an innovative endeavor in comprehending the intricate relationships among zero divisors in n . By evaluating and contrasting the efficiency and computational intricacies of distinct algorithms, this research promises a novel understanding of their strengths and limitations, offering unique insights into their applicability for generating zero divisor graphs. This novel approach intends to not only provide mathematicians, researchers, and computational enthusiasts with a comprehensive comparative overview but also to pave the way for advancements in the field of ring theory and mathematical computations. The comparative assessment is poised to illuminate unexplored facets of computational methodologies, unlocking new perspectives and applications for constructing zero divisor graphs within n and contributing to the broader landscape of mathematical inquiries. In summary, this article stands out for its innovative computational approach, practicality, insights into algebraic structures, graph theory perspectives, and its ability to bridge interdisciplinary divides, making it a valuable and pioneering addition to the fields of abstract algebra and computational mathematics.

2. Method

In this section, we delve into the benefits of creating ZDGs. When it comes to selecting between programs to write the code, your decision may hinge on your research’s unique demands and your level of familiarity with each tool. The table presented here serves as a handy reference, particularly for readers of your research article who are pondering which programming language best suits their graph-drawing needs.

Writing code in Maple and utilizing its graphing capabilities provides several unique advantages:

1) Symbolic Computation Power: Maple excels in symbolic computation, allowing manipulation of equations, expressions, and functions in a symbolic form. This capability simplifies handling complex mathematical operations, aiding in tasks like derivatives, integrals, and equation solving.

2) User-Friendly Interface: Maple offers an intuitive interface and user-friendly syntax. Its language closely resembles standard mathematical notation, making it relatively easy to learn and work with.

3) Diverse Graphing Tools: Maple boasts a wide array of graphing and visualization tools. From standard 2D and 3D plots to specialized graphs like histograms and contour plots, it accommodates diverse graphing needs.

4) Customization and Interactivity: Graphs and plots in Maple can be extensively customized—colors, styles, labels, and other visual aspects can be modified to suit specific requirements. Additionally, the software supports interactive plots, allowing users to dynamically change parameters and observe real-time alterations in the graphs.

5) Seamless Integration: Maple’s capability to write code and generate graphs within the same environment enhances workflow efficiency. This integration allows immediate visualization and verification of results without the need to switch between different software tools.

6) Mathematical Analysis and Simulations: Maple aids in mathematical analysis and simulations. It empowers users to model real-world problems, conduct simulations, and visualize outcomes through graphs, contributing to deeper comprehension and decision-making.

7) Documentation and Reproducibility: The software allows users to compile code, explanations, and visual outputs into a single document, aiding in documenting work. This feature supports reproducibility, facilitating easy sharing and replication of analyses.

8) Educational and Research Utility: Maple is widely utilized in educational settings and research environments due to its effectiveness in teaching mathematical concepts, visualizing data, and conducting research across various disciplines, including engineering, physics, and mathematics.

In summary, Maple’s seamless fusion of powerful symbolic computations with robust graphing capabilities makes it an invaluable tool for mathematical analysis and visualization.

3. MAPLE Algorithm for Generating Zero Divisor Graphs of n Modulo n


Ÿ Define the value of “n” for the ring of integers n .


Ÿ Set the value of “n” to represent n , for example, n = 10 .

Ÿ Initialize the “adjacency matrix” to portray the zero divisor graph: “adjacency matrix” = zeros(n).

Ÿ Create an array “zero divisors” to track identified zero divisors: “zero divisors” = zeros(1, n).


Ÿ Identify Zero Divisors:

Ÿ Traverse through the elements within n .

Ÿ For each element “I” from 1 to n.

Ÿ For each element “j” from 1 to n.

Ÿ Check if i j (modulo n) equals 0 and i is not equal to j.

Ÿ If this condition holds true, mark “i” as a zero divisor: “zero divisors”(i) = 1.

Ÿ Construct Zero Divisor Graph:

Ÿ Iterate through the identified zero divisors.

Ÿ For each zero divisor “i” from 1 to n.

Ÿ If “i” is a zero divisor.

Ÿ For each element “j” from 1 to n.

Ÿ If “j” is a zero divisor and i j (modulo n) equals 0 and i is not equal to j.

Ÿ Set the adjacency matrix (i, j) to 1, signifying a connection between zero divisors “i” and “j”.

Ÿ Visualization:

Ÿ Create a graph object “G” utilizing the adjacency matrix: “G” = graph (“adjacency matrix”).

Ÿ Plot the zero divisor graph with a force-directed layout: plot (“G”, “Layout”, “force”).

Ÿ Display the title “Zero Divisor Graph of n modulo n.


Ÿ Visual representation of the zero divisor graph of n modulo n.

This algorithm provides a systematic process to generate a zero-divisor graph in MAPLE for the ring of integers n modulo n, displaying relationships between zero divisors based on their interactions within the modular arithmetic structure.

4. Conclusion

In summary, this research investigation centered on evaluating the comparative effectiveness of employing MAPLE algorithms to generate zero divisor graphs (ZDGs) within the ring of integers n modulo n. ZDGs serve as pivotal visual tools in ring theory, illustrating the interrelations between ring elements that yield a product of zero. The study’s focus lies in developing and implementing diverse algorithms in MAPLE to construct these ZDGs, aiming to discern their strengths, limitations, and computational efficiency. Findings from this comparative analysis offer valuable insights, assisting mathematicians, researchers, and computational enthusiasts in comprehending the diverse algorithmic approaches available within MAPLE for ZDG creation. As for future directions, opportunities include refining algorithms for increased efficiency, exploring larger ring structures, developing interactive visualization tools, investigating parallel computing techniques, and extending the application of ZDG construction algorithms to other mathematical domains. These avenues for further exploration aim to enhance computational efficiency, scalability, and applicability, thereby contributing to a deeper understanding of ring theory and related mathematical computations.


I extend my profound gratitude to my wife for her unwavering support and encouragement, my parents and siblings for their enduring belief and invaluable guidance, and my parents-in-law and sister-in-law for their constant encouragement and understanding. Their collective emotional, moral, and practical support has been a cornerstone of my journey, providing me with the strength and motivation needed to pursue and complete this research. Their roles in this academic endeavor have been indispensable, and for that, I am eternally grateful.


Ÿ Availability of Data and Materials: The readers can find the codes used in the article at the following link:

Ÿ Funding: This study received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.

Conflicts of Interest

The author declares no conflicts of interest regarding the publication of this paper and agrees to publish this paper under academic ethics.


[1] Ali, N., Siddiqui, H.M.A. and Qureshi, M.I. (2023) A Graph-Theoretic Approach to Ring Analysis: Dominant Metric Dimensions in Zero-Divisor Graphs. arXiv: 2312.16005.
[2] Ali, N., Kousar, Z., Safdar, M., Tolasa, F.T. and Suleiman, E. (2023) Mapping Connectivity Patterns: Degree-Based Topological Indices of Corona Product Graphs. Journal of Applied Mathematics, 2023, Article ID: 8975497.
[3] Anderson, D.F. and Livingston, P.S. (1999) The Zero Divisor Graph of a Commutative Ring. Journal of Algebra, 217, 434-447.
[4] Anderson, D.F. and LaGrange, J.D. (2012) Commutative Boolean Monoids, Reduced Rings and the Compressed Zero-Divisor Graphs. Journal of Pure and Applied Algebra, 216, 1626-1636.
[5] Anderson, D.F. and LaGrange, J.D. (2016) Some Remarks on the Compressed Zero-Divisor Graphs. Journal of Algebra, 447, 297-321.
[6] Anderson, D.D. and Naseer, M. (1993) Beck’s Coloring of a Commutative Ring. Journal of Algebra, 159, 500-514.
[7] Atiyah, M.F. and MacDonald, I.G. (1969) Introduction to Commutative Algebra. Addison-Wesley, Boston.
[8] Beck, I. (1988) Coloring of Commutative Rings. Journal of Algebra, 26, 208-226.
[9] Chartrand, G., Eroh, L., Johnson, M.A. and Oellermann, O.R. (2000) Resolvability in Graphs and Metric Dimension of a Graph. Discrete Applied Mathematics, 105, 99-113.
[10] Krone, J. (2015) Algorithms for Constructing Zero-Divisor Graphs of Commutative Rings.
[11] Kelenc, A., Tratnik, N. and Yero, I.G. (2018) Uniquely Identifying the Edges of a Graph: The Edge Metric Dimension. Discrete Applied Mathematics, 251, 204-220.
[12] Saeed, R., Riaz, A., Lodhi, R.N., Munir, H.M. and Iqbal, A. (2014) Determinants of Dividend Payouts in Financial Sector of Pakistan. Journal of Basic and Applied Scientific Research, 4, 33-42.
[13] Mahboob, A., Hussain, T., Akram, M., Mahboob, S., Ali, N. and Raza, A. (2020) Characterizations of Chevalley Groups Using Order of the Finite Groups. Journal of Prime Research in Mathematics, 16, 46-51.
[14] Maimani, H.R., Pournaki, M.R. and Yassemi, S. (2006) Zero Divisor Graph with Respect to an Ideal. Communications in Algebra, 34, 923-929.
[15] Mulay, S.B. (2002) Cycles and Symmetries of Zero-Divisors. Communications in Algebra, 30, 3533-3558.
[16] Pirzada, S. (2012) An Introduction to Graph Theory. Universities Press, Orient Blackswan, Hyderabad.
[17] Pirzada, S., Raja, R. and Redmond, S.P. (2014) Locating Sets and Numbers of Graphs Associated to Commutative Rings. Journal of Algebra and Its Applications, 13, Article ID: 1450047.
[18] Pirzada, S. and Raja, R. (2016) On Graphs Associated with Modules Over Commutative Rings. Journal of the Korean Mathematical Society, 53, 1167-1182.
[19] Pirzada, S. and Raja, R. (2017) On the Metric Dimension of a Zero Divisor Graph. Communications in Algebra, 45, 1399-1408.
[20] Pirzada, S., Raja, R. and Redmond, S. (2016) On Locating Numbers and Codes of Zero Divisor Graphs Associated with Commutative Rings. Journal of Algebra and Its Applications, 15, Article ID: 1650014.
[21] Pirzada, S. and Raja, R. (2017) On the Metric Dimension of a Zero Divisor Graph. Communications in Algebra, 45, 1399-1408.
[22] Redmond, S.P. (2007) On Zero-Divisor Graphs of Small Finite Commutative Rings. Discrete Mathematics, 307, 1155-1166.
[23] Safdar, M., Mushtaq, T., Ali, N. and Akgül, A. (2023) On Study of Flow Features of Hybrid Nanofluid Subjected to Oscillatory Disk. International Journal of Modern Physics B, Article ID: 2450356.

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.