Discrete Structures
Discrete Structures
Remark:
• The set of vertices V of a graph G may be infinite.
• A graph with an infinite vertex set or an infinite number of
edges is called an infinite graph, and in comparison, a
graph with a finite vertex set and a finite edge set is called
a finite graph.
Definitions
• A graph in which each edge connects two different vertices and
where no two edges connect the same pair of vertices is called a
simple graph.
• In a simple graph, each edge is associated to an unordered pair of
vertices, and no other edge is associated to this same edge.
• Graphs that may have multiple edges connecting the same vertices
are called multigraphs.
• When there are m different edges associated to the same unordered
pair of vertices{u, v } then {u, v } is an edge of multiplicity m
Fig: A Computer
Network with Multiple
Links between Data
Centers.
DEFINITIONS
• Edges that connect a vertex to itself are called loops
• Sometimes we may even have more than one loop at a vertex.
• Graphs that may include loops, and possibly multiple edges
connecting the same pair of vertices or a vertex to itself, are
sometimes called pseudographs.
• So far the graphs we have introduced are undirected graphs.
Their edges are also said to be undirected.
DIRECTED GRAPHS
• A directed graph (or digraph) (V, E) consists of a nonempty set of vertices V and a
set of directed edges (or arcs) E . Each directed edge is associated with an ordered
pair of vertices. The directed edge associated with the ordered pair ( u, v) is said to
start at u and end at v.
• When a directed graph has no loops and has no multiple directed edges, it is called
a simple directed graph.
• Directed graphs that may have multiple directed edges from a vertex to a second
(possibly the same) vertex are used to model such networks. We called such graphs
directed multigraphs.
• When there are m directed edges, each associated to an ordered pair of vertices
(u, v ) , we say that (u, v ) is an edge of multiplicity m .
DEFINITIONS
• A graph with both directed and undirected edges is called a mixed
graph.
Although the terminology used to describe graphs may vary, three
key questions can help us understand the structure of a graph:
• Are the edges of the graph undirected or directed (or both)?
• If the graph is undirected, are multiple edges present that connect
the same pair of vertices?
• If the graph is directed, are multiple directed edges present?
• Are loops present?
For exercises 3–9, determine whether the graph shown has
directed or undirected edges, whether it has multiple edges,
and whether it has one or more loops. Use your answers to
determine the type of graph in table 1 this graph is.
10. For each undirected graph
in Exercises 3–9 that is not
simple, find a set of edges to
remove to make it simple.
Graph Terminology and Special Types of Graphs
Note: This applies even if multiple edges and loops are present.
EXAMPLE 3: How many edges are there in a graph with 10 vertices each of
degree six?
THEOREM 2: An undirected graph has an even number of vertices of
odd degree.
Definitions
• A graph with directed edges and its underlying undirected graph have the
same number of edges.
SOME SPECIAL SIMPLE GRAPHS
EXAMPLE 5:A complete graph on n vertices, denoted by kn, is a simple graph that
contains exactly one edge between each pair of distinct vertices.
The graphs kn, for n = 1 , 2 , 3 , 4 , 5 , 6, are displayed in figure 3.
A simple graph for which there is at least one pair of distinct vertex not connected by
an edge is called noncomplete.
CYCLES
WHEELS
n-Cubes
• A complete bipartite graph 𝑘𝑚,𝑛 is a graph that has its vertex set
partitioned into two subsets of m and n vertices, respectively with an
edge between two vertices if and only if one vertex is in the first subset
and the other vertex is in the second subset. The complete bipartite
graphs 𝐾2,3 , 𝐾3,3 , 𝐾3,5 , and 𝐾2,6 are displayed in figure 9.
DEFINITIONS
REPRESENTING GRAPHS AND GRAPH ISOMORPHISM
• Sometimes, two graphs have exactly the same form, in the sense that there is a one-to-one
correspondence between their vertex sets that preserves edges.
• In such a case, we say that the two graphs are isomorphic.
• Determining whether two graphs are isomorphic is an important problem of graph theory
Representing Graphs
EXAMPLE 1 Use adjacency lists to describe the simple graph given in Figure 1
EXAMPLE 3 Use an adjacency matrix to represent the graph shown in Figure 3.
Remark
• An adjacency matrix of a graph is based on the ordering chosen for the vertices.
• Hence, there may be as many as n! different adjacency matrices for a graph with n
vertices, because there are n! different orderings of n vertices.
• The adjacency matrix of a simple graph is symmetric, that is, aij = aji, because both of
these entries are 1 when vi and vj are adjacent, and both are 0 otherwise.
• Furthermore, because a simple graph has no loops, each entry aii, i = 1, 2, 3, . . . , n, is 0.
• Adjacency matrices can also be used to represent undirected graphs with loops and
with multiple edges.
• A loop at the vertex vi is represented by a 1 at the (i, i)th position of the adjacency
matrix.
• When multiple edges connecting the same pair of vertices vi and vj, or multiple loops
at the same vertex, are present, the adjacency matrix is no longer a zero–one matrix,
because the (i, j)th entry of this matrix equals the number of edges that are associated
to {vi, vj}.
• All undirected graphs, including multigraphs and pseudographs, have symmetric
adjacency matrices.
• In particular, we can show that two graphs are not isomorphic if we
can find a property only one of the two graphs has, but that is
preserved by isomorphism.
• A property preserved by isomorphism of graphs is called a graph
invariant.
• For instance, isomorphic simple graphs must have the same number of
vertices, because there is a one-to-one correspondence between the
sets of vertices of the graphs.
• Isomorphic simple graphs also must have the same number of edges,
because the one-to-one correspondence between vertices establishes a
one-to-one correspondence between edges.
• In addition, the degrees of the vertices in isomorphic simple graphs
must be the same.
• That is, a vertex v of degree d in G must correspond to a vertex f (v) of
degree d in H, because a vertex w in G is adjacent to v if and only if f
(v) and f (w) are adjacent in H.
EXAMPLE 9 Show that the graphs displayed in Figure 9 are not isomorphic.
EXAMPLE 10 Determine whether the graphs shown in Figure 10 are isomorphic
EXAMPLE 1
EULER AND HAMILTON PATHS
• Can we travel along the edges of a graph starting at a vertex and returning to
it by traversing each edge of the graph exactly once?
• Similarly, can we travel along the edges of a graph starting at a vertex and
returning to it while visiting each vertex of the graph exactly once?
Solution:
• The graph G1 has an Euler circuit, for
example, a, e, c, d, e, b, a.
• Neither G2 or G3 has an Euler circuit.
• G3 has an Euler path, namely, a, c, d,
e, b, d, a, b. G2 does not have an
Euler path
Solution:
TREES