Docsity

Introduction to Formal Graph Theory: Subsets, Cartesian Products, and Graph Definitions, Study notes of Computer Science

Toggle sidebar
bg1
Basic Graph Theory
Graph theory provides a mathematical structure that is convenient
for understanding a number of problems and writing algorithms to solve them.
At one level, graphs are very simple. They are just dots connected by lines.
The “dots”, generally drawn as labeled circles, are called “vertices” (singular is “vertex”)
or “nodes”. The lines are usually called “edges”, but may be called “links” or “arcs”.
The vertices are generally labeled by positive integers, but can be labeled otherwise.
In a graph that is read as a map, many of the vertices are labeled with city names.
One special class of graphs is called “trees”, to be defined soon.
For some reason, we tend to use the term “node” when discussing trees
and use the term “vertex” when discussing general graphs.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Partial preview of the text

Download Introduction to Formal Graph Theory: Subsets, Cartesian Products, and Graph Definitions and more Study notes Computer Science in PDF only on Docsity!

Basic Graph Theory

Graph theory provides a mathematical structure that is convenient for understanding a number of problems and writing algorithms to solve them. At one level, graphs are very simple. They are just dots connected by lines. The “dots”, generally drawn as labeled circles, are called “vertices” (singular is “vertex”) or “nodes”. The lines are usually called “edges”, but may be called “links” or “arcs”. The vertices are generally labeled by positive integers, but can be labeled otherwise. In a graph that is read as a map, many of the vertices are labeled with city names. One special class of graphs is called “trees”, to be defined soon. For some reason, we tend to use the term “node” when discussing trees and use the term “vertex” when discussing general graphs.

Formal Graph Theory

Intuitive graph theory, such as presented above, often suffices for computer science. This lecture will present an introduction to formal graph theory , which is based on set theory. A set is an unordered collection of items. Formal graph theory is based on finite subsets of the positive integers. Consider a positive integer N > 0. We consider the finite set [N] = {1, 2, …, N}, which has N elements. Thus, we might have the set {1, 2, 3, 4}. Other four–element sets, such as {A, B, C, D} are essentially equivalent to this set and are said to be isomorphic. Consider the function , defined on the set {1, 2, 3, 4} by (1) = A, (2) = B, (3) = C, and (4) = D. It can be shown that this function is an isomorphism (read your math texts). For this reason, we say that the set {1, 2, 3, 4} is isomorphic to {A, B, C, D}.

Set Theory

A set is an unordered collection of elements. The basic set operation is membership. For a set A and element a , we say a  A if a is an element of A a  A if a is not an element of A. For any set A, we usually define a universal set , U, that is the set of all elements that can be seen in the set A. We consider the vertex set of a graph as an example. If we use positive integers to label the vertices, then the universal set U, from which the vertex set is taken, is the set of all positive integers. Consider the finite set A = {2, 3, 5, 7, 11} taken from the infinite set of positive integers. We say that 2  A and 5  A, but that 9  A. The cardinality of a finite set A, denoted |A|, is the number of elements in that set.

Subsets: Proper and Otherwise

Let A and B be two arbitrary sets, defined over the same type of elements. We say that A is a subset of B, denoted as A  B, if every element that is in A is also in B. More formally: A  B if and only if a  A implies a  B. To falsify the claim that A  B it suffices to find one element a  A with a  B. Two sets A and B are equal if and only if both A  B and B  A. We say that A is a proper subset of B, denoted A  B, if A  B, but A  B.

Set Operations

Let A and B be two sets. We define the following basic set operations. The set intersection , denoted A  B, is A  B = { x | x  A and x  B }. The set union , denoted A  B, is A  B = { x | x  A or x  B }. The set difference , denoted A – B, is A – B = { x | x  A and x  B }. The set symmetric difference, denoted A  B, is A  B = (A  B) – (A  B); that is, the set of elements either in set A or in set B, but not in both sets.

Complement of a Set

In order to define the set complement, we must recall the idea of the universal set , the set of all elements from which the specific set can be selected. Let S be a set of elements taken from the universal set U. Then S  U. The complement of S, denoted S , is defined as follows: S (^) = { x | x  U and x  S }. The complement of a set cannot be defined unless the universal set of elements is also defined, either explicitly or implicitly. Let U = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, and let S = { 1, 3, 5, 7, 9} then S^ = {0, 2, 4, 6, 8}.

Formal Graph Theory

Definition: A graph G is a finite non-empty set of vertices, denoted V(G), together with a (possibly empty) finite set E  V(G)  V(G). If we define |V(G)| = N and |E(G)| = M, the graph G is called an (N, M)–graph. In the formal theory, we identify each vertex by an integer. If |V(G)| = N, we say that V(G) = {1, 2, 3, …, N}. E(G)  { (J, K) | 1  J  N and 1  K  N } There are a number of special classes of graph that we find interesting. When speaking of graphs, we normally mean “simple graphs” , formally defined as V(G) = {1, 2, 3, …, N} and E(G)  { (J, K) | 1  J  N, 1  K  N, and J  K }. A directed graph is a simple graph in which the edge (J, K) is not the same as the edge (K, J); (J, K)  (K, J). An undirected graph is a simple graph in which the edge (J, K) is defined to be the same as the edge (K, J); (J, K) = (K, J).

Graph Theory: Informal Definitions

A simple graph is a graph without edges connecting any vertex to itself; no edge of the form (J, J). The graph in the next figure is not simple, as it has edges connecting vertex 1 to itself and vertex 4 to itself. This graph at right is also described as follows V(G) = {1, 2, 3, 4} E(G) = { (1, 1), (1, 4), (2, 3), (2, 4), (4, 4) } Any simple graph over vertex set V(G) = {1, 2, 3, 4} would have E(G)  { (1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (3, 4), (4, 1), (4, 2), (4, 3) }

More on Directed and Undirected Graphs

Directed graphs correspond to edge sets that contain ordered pairs. Undirected graphs correspond to edge sets that contain unordered pairs. Consider the figure below, which shows an undirected graph and a directed graph. The two graphs appear similar, but are quite different. The graph at the left is said to be the undirected graph that underlies the directed graph. The undirected graph has E(G) = { (1, 4), (2, 3), (2, 4), (3,4) }; implicitly (3, 2)  E(G), (4, 1)  E(G), (4, 2)  E(G), and (4, 3)  E(G). The directed graph has E(G) = { (1, 4), (2, 4), (3, 2), (4, 1), (4, 3) }, with no edges implicitly added.

Still More on Directed and Undirected Graphs

Consider the following two graphs, one directed and one undirected. In what sense are they similar? Each graph has V(G) = {1, 2, 3, 4} The undirected graph has E(G) = { (1, 2), (1, 4), (2, 3), (3, 4) } more conventionally written as E(G) = { (1, 2), (2, 3), (3, 4), (4, 1) }. The directed graph has E(G) = { (1, 2), (2, 3), (3, 4), (4, 1), (1, 4), (4, 3), (3, 2), (2, 1) } The undirected graph can be seen as a simpler representation containing the same information as the directed graph. Nevertheless, they are not the same graph.

Complement of a Graph

We first define the term informally. Let G = (V(G), E(G)) be an (N, M)–graph. The complement of G, denoted GC, is GC = (V(G), E(GC)) with the same vertex set and an edge e  E(GC) if and only if e  E(G). Thus the complement graph has the identical vertex set and an edge set that is the complement of the original edge set. Remember that a definition of a complement set requires the definition of a universal set. The universal set of edges is defined differently for directed and undirected graphs. Consider graphs on the vertex set V(G) = {1, 2, …, N}. For directed graphs, the universal set of edges is U = { (J, K) | 1  J  N, 1  K  N, and J  K } For undirected graphs, the universal set of edges is U = { (J, K) | 1  J  (N – 1), J < K  N}. Complement graphs are more commonly defined for undirected graphs.

Complement of a Graph: Example

Consider the undirected graph on four vertices, defined as follows. G = (V(G), E(G) | V(G) = {1, 2, 3, 4}, E(G) = {(1, 2), (1, 3), (1, 4)} What is the complement of this graph? The universal set of edges for undirected graphs on V(G) = {1, 2, 3, 4} is defined to be U = { (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4) }. The edge set of the complement graph is E(GC) = U – E(G). U = { (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4) } E(G) = { (1, 2), (1, 3), (1, 4)} E(GC) = { (2, 3), (2, 4), (3, 4) } In pictures, the graphs are as follows.

Graphs: Walks, Paths, and Cycles

Let u and v be vertices in a graph G, with u and v not necessarily distinct. A u - v walk of G is a finite, alternating sequence of vertices and edges starting with u and ending with v : thought of as u = u 0 , e 1 , u 1 , e 2 , …., u s-1, e s, u s = v, such that e i = ( u i-1, u i). The number s , the number of edges in the sequence, is called the length of the walk. A u – v path is a u – v walk in which no vertex is repeated. A cycle is a u – v walk in which all vertices are distinct with the sole exception that u = v. A Euler Tour (Euler Circuit) of a graph is a path is a walk through the graph that covers each edge exactly one time. Vertices may be covered multiple times. A Hamiltonian Cycle of a graph is a cycle that contains each vertex exactly one time. It is likely that not all edges will be covered; no edge can be covered more than once. A graph is said to be Hamiltonian if it contains at least one Hamiltonian Cycle.

Examples of Walks, Paths, and Cycles

Consider the following sample undirected graph. Here V(G) = {1, 2, 3, 4, 5} E(G) = { (1, 2), (1, 3), (2, 3), (2, 4), (2, 5), (3, 5), (4, 5) } A (1, 4)–walk (1, 2), (2, 3), (3, 5), (5, 2), (2, 4) often written as (1, 2, 3, 4, 2, 4) – just the vertices. Note the repeated vertex. One (1, 4)–path (1, 2), (2, 4) – the shortest (1, 4)–path. Another (1, 4)–path (1, 3), (3, 5), (5, 2), and (2, 4). One cycle (1, 2), (2, 4), (4, 5), (5, 3), (3, 1) Another cycle (1, 2), (2, 3), (3, 1) – this is called a triangle.