Discrete Structures

# A Set-Theoretical Definition of Graphs

 Last Update: 16 April 2009 Note: or material is highlighted

1. The Rosen text defines graphs in terms of points and lines connecting them.
But I have said that all mathematical objects can be defined in terms of logic and set theory.
So, can we define graphs that way? Let's try:

1. Definition:
Let V be a set.
Then V is a set of vertices =def V ≠ ∅.

Comment:

Note that V isn't being defined as a (non-empty) set of (geometric) "points".
By letting the members of V be any kind of thing, we allow for all kinds of things to be considered as graphs.

2. Definition:
Let V be a set of vertices.
Then E is a set of edges on V =def E ⊆ {{vivj} | vivj ∈ V}.

I.e., E is a set of (unordered) pairs (i.e., a set of "doubletons") of vertices.

3. Definition:
Let V be a set of vertices.
Let E be a set of edges on V.
Then G is a graph on V and E =def G = (VE).

1. G is defined as an ordered pair of sets.
And in lecture I gave you the Kuratowski definition of an ordered pair (of anything) in terms of sets:
The ordered pair (xy) =def {{x}, {xy}}.

So, G = {{V}, {VE}}.

2. If V = {v1, …, vn} and if E = {{vi1vj1}, …, {vikvjk}}, then (hold your breath…) G = {{{v1, … vi}}, {{v1, … vi}, {{vi1vj1}, …, {vikvjk}}}}.

2. But there's a small problem: This definition does not allow for there to be more than one edge connecting two vertices.
Graphs that don't allow that are called "simple" graphs (or just "graphs"), and graphs that do allow that are called "multigraphs".

How can we define multigraphs set-theoretically?
The problem is that we need to allow multiple copies of elements to be in a set, and that's not allowed by the laws of set theory.
(See Rosen, p. 113, Def. 3: 2 sets are equal iff they have exactly the same elements. Therefore, a set cannot have multiple "copies" of any element.)

What we need is a notion called a "multiset" (by mathematicians) or a "bag" (by computer scientists).
The fundamental principle behind this notion is that bags can have multiple copies of elements.
Let's use angle brackets to denote bags. Then the bagxx⟩ ≠ the bagx⟩ (whereas the set {xx} = the set {x}).

But wait: We want everything to be implemented as sets! And bags aren't sets! So we need to implement bags as sets.
This can be done by implementing each member of a bag as an ordered pair whose first element is the bag-element and whose second element is a numeral
(something like a subscript)—and, of course, you know how to implement ordered pairs as sets! Here are some examples of how this can be done:

BagSet implementation
x{(x, 1)}
x, y{(x, 1), (y, 1)}
x, x{(x, 1), (x, 2)}
x, x, y{(x, 1), (x, 2), (y, 1)}
x, x, y, y{(x, 1), (x, 2), (y, 1), (y, 2)}

3. Then we can define multigraphs as ordered pairs of vertices and edges, where the edges are defined as bags of pairs of vertices.
But I'll leave the gory details to you.
(I'll also leave as an exercise for you to define directed graphs set-theoretically! Hint: E ⊆ V ×V, but you may need to take bags into account.)

Copyright © 2009 by William J. Rapaport (rapaport@cse.buffalo.edu)
http://www.cse.buffalo.edu/~rapaport/191/S09/graphasset.html-20090416-2