Algorithms for Constructing Zero-Divisor Graph
Algorithms for Constructing Zero-Divisor Graph
Joan Krone
Abstract
The idea of associating a graph with the zero-divisors of a commutative ring was
introduced in [3], where the author talked about colorings of such graphs. In [1], the
authors considered a conjecture made by Beck [3] and found a counterexample to the
conjecture. In [2], the authors investigated the interplay between the ring-theoretic
properties of a ring and a graph associated with the ring, namely the zero-divisor graph.
Here we present algorithms for deriving zero-divisor graphs for commutative rings.
These algorithms are recursive in nature and construct the graph for a given ring from
sub-graphs which themselves are zero-divisor graphs of rings of smaller orders. We put
forward algorithms to derive zero-divisor graphs for the following types of rings: Zn (all
integers with the usual addition and multiplication mod n), products of Zn rings, and En
(all even integers with the usual addition and multiplication mod n).
Introduction
Given a commutative ring, R, with unity and the set of associated zero divisors by Z(R),
define the zero-divisor graph of R, G(R) as a graph whose vertices are the nonzero zero-
divisors of R and whose edges are the joins of those vertices, v1 and v2 such that v1*v2 =
0, i.e., v1 and v2 are adjacent iff v1*v2 = 0. Note that G(R) is empty iff R is an integral
domain. Sometimes the zero-divisor graph for R is allowed to have 0 as a vertex, in
which case 0 has an edge to every other node in the graph. For simplicity, we are
choosing the definition that does not include the 0 as a vertex, since putting it in simply
adds edges to each of the remaining vertices in every case.
Once the factorization is complete, two recursive calls are made to GenerateGraph with
the factors as arguments. The fundamental theorem of arithmetic guarantees us that the
base case for this recursive algorithm will be reached and the algorithm will terminate.
Finally, there is a call to ConstructGraph, which puts together the graphs obtained for p
and q respectively.
First we will see how the zero divisor graph for a ring isomorphic to Zn where n = pk, and
then we will look at the case when n = pq.
Here is the algorithm, GetGr, called when n is the power of a prime. GetGr constructs
the zero divisor graph for Zn where n = pk.
When k = 3, the algorithm makes a recursive call to itself with parameter k – 1, i.e., 2 and
gets the graph pictured above. Now the algorithm takes that graph and multiplies the
label by p (2), getting a graph of one node labeled with 4. Then the algorithm divides the
zero divisors for Z8 into sets according to how many factors of p (2) each divisor has. In
this case one set S1, has only one entry, S1={4}, while the other set S2 has two entries,
S2={2, 6}. Next for values of j between 1 and 3, the algorithm connects nodes in the
graph from any set whose elements have k-j factors of p to the elements from the set with
j factors of p. In this case, the only value of j we need to consider is 2. S1 had entries
with p2 as a factor, while S2 has entries with p 1 as a factor. So, elements from S1 are
connected to elements from S1, resulting in
The graph of Z8
For the case when k = 4, the algorithm gets the graph just shown for k = 3, multiplies
each label by 2, separates the nodes into sets S1 = {2, 6, 10, 14), S2 = {4, 12}, and S3 =
{8}. Nodes from S1 are connected to those of S3, while the nodes in S2 are connected to
each other.
With the example as motivation, we are ready to discuss why this algorithm works.
Given the order pk of ring R, we can easily find the number of zero divisors and hence the
number of nodes in the zero divisor-graph, namely p(k-1)-1, using Euler’s theorem. The
labels on the nodes are the entries in Z n that have a common divisor with n. If k = 2,
then the zero-divisor graph is complete with p-1 nodes. Now if k > 2, then we can divide
the nodes of G(Zn) into k-1 distinct sets of nodes, each set of nodes distinguished by the
factor of p its label has. There are k-1 different sets. Each node within a particular set has
the same number of factors of p. In general, a set with whose labels have j factors of p
k -1
has I(j)=p k-j – 1 - Â I(k-h-1) nodes. How these nodes are connected to each other
h= j
depends on the number of factors of p in the node labels. Every node that is in a set with
a p factor number bigger or equal to Èk/2˘ is connected to itself. Each node that is
connected to itself is connected to every other node from the same set. This means that
the nodes from each set that has nodes with number of p factors greater than Èk/2˘ form a
complete sub graph. A node with a particular number of p factors, x, is connected to a
node with power y p-factors if x + y ≥ k . This means if a node from a set with power x is
connected to a to a node from a set with power y then every node from the set with power
x is connected to every other node from the set with power y.
Now when we have a Zn where n=pk we have p-1 elements that are divisible by pk-1 (they
form a set with k-1 elements), p2-1-(p-1) elements divisible by pk-2 (excluding those
divisible by pk-1) and they form the set of power k-2, p3-1-(p2-1+p-1) elements divisible
by pk-3 (excluding those divisible by pk-1 and pk-2) and they form the set of power k-3 and
so on. If a node is of power j and h<k such that j+h>=k then the nodes from the set with
power j are connected to the nodes from the set with power h(since pk divides pjph). If
j+j>=k then the nodes from the set with power j are connected among them-selves(since
pk divides pjpj). The GetGr algorithm is doing the following: it starts from the graph of p2
and builds up gradually to pk each time adding a new set of nodes with power one and
drawing the proper edges to complete the zero-divisor graph for the current power of p.
For every two nodes x and y there are two possibilities: first x and y are from the
same set, and second x and y are in different sets. If x and y are in the same set and they
are connected the algorithm guaranties that x and y are in a set with power bigger or
equal to ceiling(k/2). It also guaranties that all of these sets have their nodes connected to
themselves. If x and y are from different sets then the algorithm guaranties that these
nodes are connected if and only if their powers add up to a number bigger than or equal
to k. From what we said above follows that the algorithm GetGr correctly derives the zero
divisor graph of cyclic ring R of order pk. Do we omit edges or nodes? No we do not omit
nodes because all the numbers that are not relatively prime to n=pk are p k-1-1, and we
always have pk-1-1 nodes. For a node x (divisible by ph, where ph is the biggest number
divisible by p, x is divisible by) and a node y (divisible by pj, where pj is the biggest
number divisible by p, y is divisible by) to be connected pj ph should be divisible by pk . In
order for this to happen j+h should be bigger or equal to k. The algorithms guaranties that
we are not going to omit an edge between any x and y. Keeping this is mind let’s do an
inductive proof.
Theorem1: The GetGr algorithm produces the zero-divisor graph for any Zn ring, R, of
order pk where p is any prime and k is any integer bigger than 1.
Proof by induction:
Base Case: If we have a group of order p2 then its zero divisor-graph is complete and has
p-1 nodes.
Inductive Step: Assume we have constructed the graph of Zn, n=pk-1. It has pk-2 -1 nodes,
labeled with the zero divisors of Z p k -1 We want to construct the graph of Z p k . We first
multiply the labels on the nodes by p, obtaining zero divisors in Z p k . Now add pk-1 –1-
(pk-2 –1) additional nodes, each labeled with zero divisors of Z p k that have only one factor
of p. Form k-1 sets, S, of labeled nodes, according to the number of factors of p in the
label. Connect the nodes from set Si to set Sj if i+j=k. If the nodes of the set with power
ceiling(k/2) do not form a clique make them form a clique. The newly formed graph has
all of the zero-divisors of Z p k labeled correctly with edges connecting nodes whose labels
yield zero when multiplied. By induction, the GetGr algorithm correctly constructs the
zero divisor graph for rings of the form Z p k .
Now we turn to the third case, finding the zero divisor graph for Zn when n is neither a
prime nor a power of a prime. In this case, n is factored into two relatively prime factors,
p and q. Zn is represented by its isomorphic ring Zp ¥ Zq. Zero divisors are found for Zp
and Zq. Finally, another algorithm, ConstructGraph, is called to construct the graph for
Zn.
To motivate the algorithm, we look at an example. Suppose we want the graph for Z4 ¥
Z9. Calls to GenerateGraph provide a zero divisor graph of one node labeled with 2 for
Z4 and two nodes labeled 3 and 6 for Z9. We will label our new graph for Z4 ¥ Z9 with
pairs, of the form (x, y), x from Z4 and y from Z9.
We can use a two dimensional array to visualize the elements of this ring:
For constructing the graph, we omit the (0, 0) as a label. We connect nodes labeled with
each element of the form (0, y) to every element of the form (x, 0). Then we form nodes
labeled with pairs of the form (d, 0) where d is a zero divisor (a label in the graph for Z4)
and connect them with nodes labeled (e, 0) where d*e = 0 mod Z4. To make the graph
easier to read, rather than using the pairs as labels, we use the labels in Z36 corresponding
to the pairs in Z4 ¥ Z9 under the canonical isomorphism between the two rings [4].
We also form nodes (0, a) and connect them to (0, b) where a*b = 0 mod Z9.
Finally, we label nodes with pairs of the form (a, b) and (c, d) where a*b = 0 mod Z4 and
c*d = 0 mod Z9.
Here is the algorithm:
Theorem 2. The ConstructGraph algorithm creates a graph for Zp ¥ Zq where p and q are
relatively prime.
Summary
We have presented algorithms to create zero divisor graphs for rings
isomorphic to Zn or to En. The algorithms build the graphs of larger
rings by using those of smaller rings. For those who are interested in
addressing additional issues relative to these kinds of graphs, our
algorithms have been implemented in C++ and a program for generating
graphs described here can be obtained from
http://www.denison.edu/~krone.
In future work we will consider zero divisor graphs for other kinds of rings such as
polynomial rings, rings of matrices and other non-commutative rings.
References