You are on page 1of 2

Chapter 1

Relations and Digraphs

1.1 Introduction
Relations and digraphs (directed graphs) are ubiquitous in the the-
ory of loop transformations. To study something as basic as the
execution ordering of the iterations of a loop nest, we need to know-
about several ways of partially ordering integer vectors. The most
important concept in loop transformations, namely that of depen-
dence, can be viewed as a relation between the members of a certain
set. This set could be the set of iterations of a loop nest, or the
set of statements in the body of the nest, or the set of instances
of the statements. We can even go to a lower level and talk about
dependence between 'loads' and 'stores,' or to a higher level and
discuss dependence between large parts of a program.
The graphs that arise in the theory of loop transformations are
digraphs for the most part, although it is occasionally necessary to
consider the underlying undirected graph of a given directed graph.
Digraphs are very closely associated with relations; in fact, in this
book, we define a digraph simply as a nonempty set with a relation
in it. The geometric point of view of digraphs is naturally suited
to some situations and provides for a more intuitive description.
For example, it is beneficial to represent the dependence relation
between statements in a program as a digraph, and then use the
terms and results from graph theory in the decomposition of the
CHAPTER 1. RELATIONS AND DIGRAPHS

program, based on dependence.


We assume that the reader is famihar with relations and both
kinds of graphs. The purpose of this chapter is to collect those
definitions and results in the theories of relations and digraphs that
will be needed throughout the book. This chapter is, by necessity,
rather condensed; it should not be used to learn about relations
or digraphs for the first time. We have used the Halmos classic
[Halm65] as the basis for the section on relations, and consulted
[Even79], [Gibb85], [Knut73], and [Prat76] for the preparation of
the section on digraphs.

1.2 Relations
The Cartesian product, S x T, oi two sets S and T is the set of all
ordered pairs of the form (a, b) where a € 5 and b £ T. A relation
from a set S to a set T is any subset of S x T. A relation in a set S
is a subset of 5 x 5 . U R is a, relation in S and (a, b) E R, we write
aRb. The inverse of a relation R, denoted by R^^, is obtained by
reversing each of the pairs belonging to R, so that aR~^ b iS bRa.
Let R'^ denote the union and R^ the intersection of a collection of
relations {Rk : k E C} in S, where C is some nonempty index set.
Then a R^ b iS aR^b for some k in C, and aR' b iff aRkb for each
k in C. A relation R in a set S is

reflexive if a i? a is true for each a,


irreflexive ii aRa is false for each a,
symmetric ii a Rb implies bRa,
antisymmetric ii aRb and bRa imply a = b,
transitive ii a Rb and bRc imply a Re,

where a, b, and c denote arbitrary elements of S. The transitive


closure, R, of a relation i? in 5 is the smallest transitive relation in
S containing R. We have aRb iH there is a sequence ai,02, - . . , a „
of elements of S, such that

a = ai, ai Ra-i, 02 ^ ^ 3 , . . . , a„_i Ran, a„ = b.

You might also like