0% found this document useful (0 votes)
24 views90 pages

Chapter10 V02-Amal

Chapter 10 covers the fundamentals of graphs and graph models, including definitions, terminology, and various types of graphs such as directed, undirected, multigraphs, and pseudographs. It also discusses applications of graph theory in fields like computer networks, social networks, and transportation systems. Key concepts include graph connectivity, special types of graphs, and the handshaking theorem related to vertex degrees.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views90 pages

Chapter10 V02-Amal

Chapter 10 covers the fundamentals of graphs and graph models, including definitions, terminology, and various types of graphs such as directed, undirected, multigraphs, and pseudographs. It also discusses applications of graph theory in fields like computer networks, social networks, and transportation systems. Key concepts include graph connectivity, special types of graphs, and the handshaking theorem related to vertex degrees.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 90

Graphs

Chapter 10

With Question/Answer Animations

© 2019 McGraw-Hill Education. All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education.
Chapter Summary
• 10.1 Graphs and Graph Models
• 10.2 Graph Terminology and Special Types of Graphs
• 10.3 Representing Graphs and Graph Isomorphism
• 10.4 Connectivity
• 10.6 Euler and Hamiltonian Graphs
• 10.7 Shortest-Path Problems (not currently included in
overheads)
• 10.8 Planar Graphs (not currently included in overheads)
• 10.9 Graph Coloring (not currently included i-n
overheads)
© 2019 McGraw-Hill Education
Graphs and Graph Models
Section 10.1

© 2019 McGraw-Hill Education


Section Summary 1

• Introduction to Graphs
• Graph Taxonomy
• Graph Models

© 2019 McGraw-Hill Education


Graphs
Definition: A graph G = (V, E) consists of a nonempty set V of vertices (or nodes)
and a set E of edges. Each edge has either one or two vertices associated with it,
called its endpoints. An edge is said to connect its endpoints.
Example:
This is a graph with four
vertices and five edges.

Remarks:
• The graphs we study here are unrelated to graphs of functions studied in Chapter 2.
• We have a lot of freedom when we draw a picture of a graph. All that matters is the
connections made by the edges, not the particular geometry depicted. For example,
the lengths of edges, whether edges cross, how vertices are depicted, and so on, do
not matter
• A graph with an infinite vertex set is called an infinite graph. A graph with a finite
vertex set is called a finite graph. We (following the text) restrict our attention to
finite graphs.
© 2019 McGraw-Hill Education
Some Terminology 1

In a simple graph each edge connects two different vertices and no two edges
connect the same pair of vertices.
Multigraphs may have multiple edges connecting the same two vertices.
When m different edges connect the vertices u and v, we say that {u,v} is an
edge of multiplicity m.
An edge that connects a vertex to itself is called a loop.
A pseudograph may include loops, as well as multiple edges connecting the
same pair of vertices.

Example: Remark: There is no standard


This pseudograph terminology for graph theory. So,
has both multiple it is crucial that you understand
edges and a loop. the terminology being used
whenever you read material
about graphs.
© 2019 McGraw-Hill Education
Directed Graphs 1

Definition: An directed graph (or digraph) G = (V, E)


consists of a nonempty set V of vertices (or nodes) and
a set E of directed edges (or arcs).
Each 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.
Remark:
• Graphs where the end points of an edge are not ordered are
said to be undirected graphs.

© 2019 McGraw-Hill Education


Some Terminology 2

A simple directed graph has no loops and no multiple edges.


Example:
This is a directed graph with
three vertices and four edges.

A directed multigraph may have multiple directed edges. When


there are m directed edges from the vertex u to the vertex v,
we say that (u,v) is an edge of multiplicity m.
Example:

multiplicity of (a,b) is 1 and the


In this directed multigraph the

multiplicity of (b,c) is 2.
© 2019 McGraw-Hill Education
Graph Models:
Computer Networks 1

When we build a graph model, we use the appropriate type of graph to


capture the important features of the application.
We illustrate this process using graph models of different types of computer
networks. In all these graph models, the vertices represent data centers and
the edges represent communication links.
To model a computer network where we are only concerned whether two
data centers are connected by a communications link,
we use a simple graph.
This is the appropriate type of graph when we only care whether two data
centers are directly linked (and not how many links there may be) and all
communications links work in both directions.

Jump to long description


© 2019 McGraw-Hill Education
Graph Models:
Computer Networks 2
To model a computer network
where we care about the number
of links between data centers,
we use a multigraph.
To model a computer network
with diagnostic links at data
centers,
we use a pseudograph, as loops
are needed.
To model a network with multiple one-way
links,
we use a directed multigraph.
Note that we could use a directed graph
without multiple edges if we only care
whether there is at least one link from a data
center to another data center.
Jump to long description
© 2019 McGraw-Hill Education
Graph Terminology: Summary
To understand the structure of a graph and to build a graph
model, we ask these questions:
• Are the edges of the graph undirected or directed (or both)?
• If the edges are undirected, are multiple edges present that connect the
same pair of vertices? If the edges are directed, are multiple directed
edges present?
• Are loops present?

TABLE 1 Graph Terminology.


Type Edges Multiple Edges Allowed? Loops Allowed?
Simple graph Undirected No No
Multigraph Undirected Yes No
Pseudograph Undirected Yes Yes
Simple directed graph Directed No No
Directed multigraph Directed Yes Yes
Mixed graph Directed and undirected Yes Yes

© 2019 McGraw-Hill Education


Other Applications of Graphs
We will illustrate how graph theory can be used in models
of:
• Social networks
• Communications networks
• Information networks
• Software design
• Transportation networks
• Biological networks

It’s a challenge to find a subject to which graph theory has


not yet been applied. Can you find an area without
applications of graph theory?
© 2019 McGraw-Hill Education
Graph Terminology and
Special Types of Graphs
Section 10.2

© 2019 McGraw-Hill Education


Section Summary 2

• Basic Terminology
• Some Special Types of Graphs
• Bipartite Graphs
• Bipartite Graphs and Matchings (not currently
included in overheads)
• Some Applications of Special Types of Graphs (not
currently included in overheads)
• New Graphs from Old

© 2019 McGraw-Hill Education


Basic Terminology
Definition 1. Two vertices u, v in an undirected graph G are
called adjacent (or neighbors) in G if there is an edge e between
u and v. Such an edge e is called incident with the vertices u and v
and e is said to connect u and v.
Definition 2. The set of all neighbors of a vertex v of G = (V, E),
denoted by N(v), is called the neighborhood of v.
If A is a subset of V, we denote by N(A) the set of all vertices in G
that are adjacent to at least one vertex in A. So, N  A vA N v .
Definition 3. The degree of a vertex in an undirected graph is the
number of edges incident with it, except that a loop at a vertex
contributes two to the degree of that vertex. The degree of the
vertex v is denoted by deg(v).

© 2019 McGraw-Hill Education


Degrees and Neighborhoods of
Vertices
Example: What are the degrees and neighborhoods of the
vertices in the graphs G and H?

Solution:
G: deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d ) = 1,
deg(e) = 3, deg(g) = 0. Vertix g in graph G is
called isolated
N(a) = {b, f }, N(b) = {a, c, e, f }, N(c) = {b, d, e, f }, N(d)
= {c},
Vertix d in graph G is
N(e) = {b, c , f }, N(f) = {a, b, c, e}, N(g) =  . called pendant
H: deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, deg(d) = 5.
N(a) = {b, d, e}, N(b) = {a, b, c, d, e}, N(c) = {b},
N(d) = {a, b, e}, N(e) = {a, b ,d}.
Jump to long description
© 2019 McGraw-Hill Education
© 2019 McGraw-Hill Education
© 2019 McGraw-Hill Education
Degrees of Vertices
Theorem 1 (Handshaking Theorem): If G = (V,E) is an undirected
graph with m edges, then

2m  vV deg v 

Proof:

Each edge contributes twice to the degree count of all vertices. Hence,
both the left-hand and right-hand sides of this equation equal twice
the number of edges.

Think about the graph where vertices represent the people at a party
and an edge connects two people who have shaken hands.

© 2019 McGraw-Hill Education


Handshaking Theorem
We now give two examples illustrating the usefulness of the
handshaking theorem.

Example: How many edges are there in a graph with 10 vertices of


degree six?

Solution: Because the sum of the degrees of the vertices is


6  10 = 60, the handshaking theorem tells us that 2m = 60. So the
number of edges m = 30.

Example: If a graph has 5 vertices, can each vertex have degree 3?

Solution: This is not possible by the handshaking theorem, because the


sum of the degrees of the vertices 3  5 = 15 is odd.

© 2019 McGraw-Hill Education


Degree of Vertices
Theorem 2: An undirected graph has an
even number of vertices of odd degree.

© 2019 McGraw-Hill Education


Directed Graphs 2

Recall the definition of a directed graph.


Definition: An directed graph G = (V, E) consists of V,
a nonempty set of vertices (or nodes), and E, a set of
directed edges or arcs. Each edge is an ordered pair of
vertices. The directed edge (u,v) is said to start at u
and end at v.
Definition: Let (u,v) be an edge in G. Then u is the initial
vertex of this edge and is adjacent to v and v is the terminal
(or end) vertex of this edge and is adjacent from u. The
initial and terminal vertices of a loop are the same.

© 2019 McGraw-Hill Education


Directed Graphs 3

Definition: The in-degree of a vertex v, denoted deg−(v), is


the number of edges which terminate at v. The out-degree of
v, denoted deg+(v), is the number of edges with v as their
initial vertex.
Note that a loop at a vertex contributes 1 to both the in-
degree and the out-degree of the vertex.
Example: In the graph G we have
deg  a  2, deg  b 2, deg  c 3, deg  d  2,
deg  e 3, deg   f  0.

deg  a  4, deg  b 1, deg  c  2, deg  d  2,


deg  e 3, deg   f  0.
Jump to long description
© 2019 McGraw-Hill Education
Directed Graphs 4

Theorem 3: Let G = (V, E) be a graph with directed


edges. Then:

| E | deg v   deg v .


 

v V v V

Proof: The first sum counts the number of outgoing


edges over all vertices and the second sum counts the
number of incoming edges over all vertices. It follows
that both sums equal the number of edges in the graph.

© 2019 McGraw-Hill Education


Special Types of Simple Graphs:
Complete Graphs
A complete graph on n vertices, denoted by Kn, is the
simple graph that contains exactly one edge between
each pair of distinct vertices.

© 2019 McGraw-Hill Education


Special Types of Simple Graphs: Cycles
and Wheels
A cycle Cn for n ≥ 3 consists of n vertices v1, v2 ,⋯ , vn, and
edges {v1, v2}, {v2, v3} ,⋯ , {vn-1, vn}, {vn, v1}.

A wheel Wn is obtained by adding an additional vertex to a


cycle Cn for n ≥ 3 and connecting this new vertex to each of
the n vertices in Cn by new edges.

Jump to long description


© 2019 McGraw-Hill Education
Special Types of Simple Graphs:
n-Cubes
An n-dimensional hypercube, or n-cube, Qn, is a
graph with 2n vertices representing all bit strings
of length n, where there is an edge between two
vertices that differ in exactly one bit position.

Jump to long description


© 2019 McGraw-Hill Education
Special Types of Graphs and Computer
Network Architecture
Various special graphs play an important role in the design of computer
networks.

Some local area networks use a star topology, which is a complete bipartite graph K1,n ,as shown
in (a). All devices are connected to a central control device.
Other local networks are based on a ring topology, where each device is connected to exactly two
others using Cn ,as illustrated in (b). Messages may be sent around the ring.
Others, as illustrated in (c), use a Wn – based topology, combining the features of a star topology
and a ring topology.
Various special graphs also play a role in parallel processing where processors need to be
interconnected as one processor may need the output generated by another.
• The n-dimensional hypercube, or n-cube, Qn, is a common way to
connect processors in parallel, e.g., Intel Hypercube.

for 16 processors.
• Another common method is the mesh network, illustrated here
Jump to long description
© 2019 McGraw-Hill Education
Bipartite Graphs 1

Definition: A simple graph G is bipartite if V can be partitioned into


two disjoint subsets V1 and V2 such that every edge connects a vertex
in V1 and a vertex in V2. In other words, there are no edges which
connect two vertices in V1 or in V2.

It is not hard to show that an equivalent definition of a bipartite graph


is a graph where it is possible to color the vertices red or blue so that
no two adjacent vertices are the same color.

H is not bipartite
G is since if we color a
bipartite red, then the
adjacent vertices f
and b must both
be blue.

© 2019 McGraw-Hill Education


Bipartite Graphs

© 2019 McGraw-Hill Education


Bipartite Graphs

Yes, G is a bipartite graph

© 2019 McGraw-Hill Education


No, H is not a bipartite graph
© 2019 McGraw-Hill Education
Complete Bipartite Graphs
Definition: A complete bipartite graph Km,n is a graph that
has its vertex set partitioned into two subsets V1 of size m
and V2 of size n such that there is an edge from every
vertex in V1 to every vertex in V2.

Example: We display four complete bipartite graphs here.

Jump to long description


© 2019 McGraw-Hill Education
New Graphs from Old 1

Definition: A subgraph of a graph G = (V,E) is a graph (W,F),


where W ⊂ V and F ⊂ E. A subgraph H of G is a proper subgraph
of G if H ≠ G.

Example: Here we show K5 and


one of its subgraphs.

Definition: Let G = (V, E) be a simple graph. The subgraph


induced by a subset W of the vertex set V is the graph (W,F),
where the edge set F contains an edge in E if and only if both
endpoints are in W.

Example: Here we show K5 and the


subgraph induced by W = {a,b,c,e}.
Jump to long description
© 2019 McGraw-Hill Education
Bipartite Graphs and Matchings

© 2019 McGraw-Hill Education


Bipartite Graphs and Matchings

Eric assigned task 5, David assigned task 3, Chris assigned task 4

Adam assigned task 1, Ben assigned task 2


© 2019 McGraw-Hill Education
Bipartite Graphs and Matchings
Bipartite graphs are used to model applications that involve matching
the elements of one set to elements in another, for example:
Job assignments - vertices represent the jobs and the employees, edges
link employees with those jobs they have been trained to do. A common
goal is to match jobs to employees so that the most jobs are done.

Marriage - vertices represent the men and the women and edges link a
man and a woman if they are an acceptable spouse. We may wish to
find the largest number of possible marriages.
See the text for more about matchings in bipartite graphs.
Jump to long description
© 2019 McGraw-Hill Education
New Graphs from Old 2

Definition: The union of two simple graphs

graph with vertex set V1 ⋃ V2 and edge set E1


G1 = (V1, E1) and G2 = (V2, E2) is the simple

⋃ E2. The union of G1 and G2 is denoted by G1


⋃ G2.
Example:

Jump to long description


© 2019 McGraw-Hill Education
Representing Graphs and
Graph Isomorphism
Section 10.3

© 2019 McGraw-Hill Education


Section Summary 3

• Adjacency Lists
• Adjacency Matrices
• Incidence Matrices
• Isomorphism of Graphs

© 2019 McGraw-Hill Education


Representing Graphs:
Adjacency Lists
Definition: An adjacency list can be used to represent a graph with no multiple
edges by specifying the vertices that are adjacent to each vertex of the graph.
TABLE 1 An Adjacency List for a Simple Graph.
Example: Vertex Adjacent Vertices
a b, c, e
b a
c a, d, e
d c, e
e a, c, d

TABLE 2 An Adjacency List for a Directed Graph.


Initial Vertex Terminal Vertices
a b, c, d, e
Example: b b, d
c a, c, e
d
e b, c, d

Jump to long description


© 2019 McGraw-Hill Education
Representation of Graphs: Adjacency
Matrices 1

Definition: Suppose that G = (V, E) is a simple graph


where |V| = n. Arbitrarily list the vertices of G as v1, v2,
… , vn. The adjacency matrix AG of G, with respect to the
listing of vertices, is the n n zero-one matrix with 1 as
its (i, j)th entry when vi and vj are adjacent, and 0 as its
(i, j)th entry when they are not adjacent.
• In other words, if the graphs adjacency matrix is
AG = [aij], then
 
1 if vi , v j is an edge of G,
aij 
0 otherwise.

© 2019 McGraw-Hill Education


Representation of Graphs: Adjacency
Matrices 2

Example: When a graph is sparse,


that is, it has few edges
0 1 1 1 relatively to the total
1 0 1 0
  number of possible edges,
1 1 0 0 The ordering of it is much more efficient
  vertices is a, b, c, d. to represent the graph
1 0 0 0
using an adjacency list
than an adjacency matrix.
0 1 1 0 But for a dense graph,
1 0 0 1 which includes a high
  The ordering of
1 0 0 1 vertices is a, b, c, d. percentage of possible
  edges, an adjacency
0 1 1 0
matrix is preferable.

Note: The adjacency matrix of a simple graph is symmetric, i.e., aij = aji
Also, since there are no loops, each diagonal entry aii for i = 1, 2, 3, …, n, is
0.
© 2019 McGraw-Hill Education
Representation of Graphs: Adjacency
Matrices 3

Adjacency matrices can also be used to represent graphs with loops and
multiple edges.

A loop at the vertex vi is represented by a 1 at the (i, j)th position of the matrix.

When multiple edges connect the same pair of vertices vi and vj, (or if multiple
loops are present at the same vertex), the (i, j)th entry equals the number of
edges connecting the pair of vertices.

Example: We give the adjacency matrix of the pseudograph shown here using
the ordering of vertices a, b, c, d.

0 3 0 2
3 0 1 1
 
0 1 1 2
 
2 1 2 0

Jump to long description


© 2019 McGraw-Hill Education
Representation of Graphs: Adjacency
Matrices 4

graphs. The matrix for a directed graph G = (V, E) has a 1 in its


Adjacency matrices can also be used to represent directed

(i, j)th position if there is an edge from vi to vj, where v1, v2, … vn
is a list of the vertices.
• In other words, if the graphs adjacency matrix is AG = [aij], then

 
1 if vi , v j is an edge of G,
aij 
0 otherwise.
• Does the adjacency matrix of a di-graph be symmetric?
• The adjacency matrix for a directed graph does not have to be symmetric, because
there may not be an edge from vi to vj, when there is an edge from vj to vi.

• To represent directed multigraphs, the value of aij is the number of edges


connecting vi to vj.
© 2019 McGraw-Hill Education
Representation of Graphs: Incidence
Matrices 1

Definition: Let G = (V, E) be an undirected graph


with vertices where v1, v2, … vn and edges
e1, e2, … em. The incidence matrix with respect
to the ordering of V and E is the n × m matrix
M = [mij], where
1 when edge e j is incident with vi ,
mij 
0 otherwise.

© 2019 McGraw-Hill Education


Representation of Graphs: Incidence
Matrices 2

Example: Simple Graph and Incidence Matrix


The rows going from top to
1 1 0 0 0 0
0 bottom represent v1 through
0 1 1 0 1
  v5 and the columns going
0 0 0 0 1 1
  from left to right represent
1 0 1 0 0 0
e1 through e6.
 0 1 0 1 1 0 

Example: Pseudograph and Incidence Matrix


The rows going from top to
1 1 1 0 0 0 0 0 bottom represent v1 through
0 0

1 1 1 0 1 1
 v5 and the columns going
0 0 0 1 1 0 0 0 from left to right represent
 
0 0 0 0 0 0 1 1 e1 through e8.
 0 0 0 0 1 1 0 0 
Jump to long description
© 2019 McGraw-Hill Education
Isomorphism of Graphs 1

Definition: The simple graphs G1 = (V1, E1) and


G2 = (V2, E2) are isomorphic if there is a (Bijective
function) one-to-one and onto function f from
V1 to V2 with the property that a and b are
adjacent in G1 if and only if f(a) and f(b) are
adjacent in G2 , for all a and b in V1 .
Such a function f is called an isomorphism.
Two simple graphs that are not isomorphic are
called nonisomorphic.
© 2019 McGraw-Hill Education
© 2019 McGraw-Hill Education
© 2019 McGraw-Hill Education
Isomorphism of Graphs 2

Example: Show that the graphs G =(V, E) and


H = (W, F) are isomorphic.
Solution: The function f with f(u1) = v1,
f(u2) = v4, f(u3) = v3, and f(u4) = v2 is a
one-to-one correspondence between V and W. Note
that adjacent vertices in G are u1 and u2, u1 and u3, u2
and u4, and u3 and u4. Each of the pairs f(u1) = v1 and
f(u2) = v4, f(u1) = v1 and f(u3) = v3 , f(u2) = v4 and
f(u4) = v2 , and f(u3) = v3 and f(u4) = v2 consists of two
adjacent vertices in H.
Verify using adjacency Jumpmatrices
to long description
© 2019 McGraw-Hill Education
Verification of the previous example
using adjacency matrices

© 2019 McGraw-Hill Education


Isomorphism of Graphs 4

Example: Determine whether these two graphs


are isomorphic.

Solution: Both graphs have eight vertices and ten edges. They also both have
four vertices of degree two and four of degree three.

However, G and H are not isomorphic. Note that since deg(a) = 2 in G, a must
correspond to t, u, x, or y in H, because these are the vertices of degree 2. But
each of these vertices is adjacent to another vertex of degree two in H, which
is not true for a in G.

Alternatively, note that the subgraphs of G and H made up of vertices


of degree three and the edges connecting them must be isomorphic.
But the subgraphs, as shown at the right, are not isomorphic.

Jump to long description


© 2019 McGraw-Hill Education
Isomorphism of Graphs 5

Example: Determine whether these two graphs


are isomorphic.

Solution: Both graphs have six vertices and seven edges.

They also both have four vertices of degree two and two of degree three.

The subgraphs of G and H consisting of all the vertices of degree two and the edges
connecting them are isomorphic. So, it is reasonable to try to find an isomorphism f.

We define an injection f from the vertices of G to the vertices of H that preserves the
degree of vertices. We will determine whether it is an isomorphism.

The function f with f(u1) = v6, f(u2) = v3, f(u3) = v4, and f(u4) = v5 , f(u5) = v1, and f(u6) = v2 is a
one-to-one correspondence between G and H. Showing that this correspondence
preserves edges is straightforward, so we will omit the details here. Because f is an
isomorphism, it follows that G and H are isomorphic graphs.

See the text for an illustration of how adjacency matrices can be used for this verification.
Jump to long description
© 2019 McGraw-Hill Education
Connectivity
Section 10.4

© 2019 McGraw-Hill Education


Section Summary 4

Paths
Connectedness in Undirected Graphs
Vertex Connectivity and Edge Connectivity (not
currently included in overheads)
Connectedness in Directed Graphs
Paths and Isomorphism (not currently included
in overheads)
Counting Paths between Vertices
© 2019 McGraw-Hill Education
Paths 1

Informal Definition: A path is a sequence of edges that


begins at a vertex of a graph and travels from vertex to
vertex along edges of the graph. As the path travels
along its edges, it visits the vertices along this path, that
is, the endpoints of these.
Applications: Numerous problems can be modeled with
paths formed by traveling along edges of graphs such
as:
• determining whether a message can be sent between two
computers.
• efficiently planning routes for mail delivery.
© 2019 McGraw-Hill Education
Paths 2

Definition: Let n be a nonnegative integer and G an undirected graph. A path


of length n from u to v in G is a sequence of n edges e1, … , en of G for which
there exists a sequence x0 = u, x1, …, xn-1, xn = v of vertices such that ei has, for
i = 1, …, n, the endpoints xi-1 and xi.

• When the graph is simple, we denote this path by its vertex sequence
x0, x1, … , xn(since listing the vertices uniquely determines the path).

• The path is a circuit if it begins and ends at the same vertex (u = v) and has length
greater than zero.

• The path or circuit is said to pass through the vertices x1, x2, … , xn-1 and traverse
the edges e1, … , en.

• A path or circuit is simple if it does not contain the same edge more than once.
This terminology is readily extended
to directed graphs. (see text)

© 2019 McGraw-Hill Education


Paths 3

Example: In the simple graph here:


• a, d, c, f, e
• is a simple path of length 4.

• d, e, c, a
• is not a path because e is not connected to c.

• b, c, f, e, b is a
• circuit of length 4.

• a, b, e, d, a, b
• is a path of length 5, but it is not a simple path.

© 2019 McGraw-Hill Education


Degrees of Separation
Example: Paths in Acquaintanceship Graphs. In an
acquaintanceship graph there is a path between two people if
there is a chain of people linking these people, where two
people adjacent in the chain know one another.
What about Kamini and Ching?
In this graph there is a chain of six people linking Kamini and
Ching.
Some have speculated that almost
every pair of people in the world are
linked by a small chain of no more
than six, or maybe even, five people.
The play Six Degrees of Separation
by John Guare is based on this
notion.

© 2019 McGraw-Hill Education


Connectedness in Undirected Graphs
Definition: An undirected graph is called connected if there is a
path between every pair of vertices. An undirected graph that is
not connected is called disconnected.
We say that we disconnect a graph when we remove vertices or
edges, or both, to produce a disconnected subgraph.
Example: G1 is connected because there is a path between any
pair of its vertices, as can be easily seen. However G2 is not
connected because there is no path between vertices a and f, for
example.

Jump to long description


© 2019 McGraw-Hill Education
Connected Components
Definition: A connected component of a graph G is a connected
subgraph of G that is not a proper subgraph of another connected
subgraph of G. A graph G that is not connected has two or more
connected components that are disjoint and have G as their union.
That’s, a connected component of G is a maximal connected
subgraph of G
Definition: A subgraph of a graph G = (V,E) is a graph (W,F), where W ⊂ V
and F ⊂ E. A subgraph H of G is a proper subgraph of G if H ≠ G.

Example: The graph H is the union of three


disjoint subgraphs H1, H2, and H3, none of
which are proper subgraphs of a larger
connected subgraph of G. These three
subgraphs are the connected components of
H.
Jump to long description
© 2019 McGraw-Hill Education
Connectedness in Directed Graphs 1

Definition: A directed graph is strongly connected if


there is a path from a to b and a path from b to a
whenever a and b are vertices in the graph.

Definition: A directed graph is weakly connected if


there is a path between every two vertices in the
underlying undirected graph, which is the
undirected graph obtained by ignoring the
directions of the edges of the directed graph.

© 2019 McGraw-Hill Education


Connectedness in Directed Graphs 2

Example: G is strongly connected


because there is a path between any
two vertices in the directed graph.
Hence, G is also weakly connected.
The graph H is not strongly connected,
since there is no directed path from a to b,
but it is weakly connected.
Definition: The subgraphs of a directed graph G that are strongly
connected but not contained in larger strongly connected subgraphs,
that is, the maximal strongly connected subgraphs, are called the
strongly connected components or strong components of G.
Example (continued): The graph H has three strongly connected
components, consisting of the vertex a; the vertex e; and the subgraph
consisting of the vertices b, c, d and edges (b,c), (c,d), and (d,b).
Jump to long description
© 2019 McGraw-Hill Education
Appendix of Image Long
Descriptions

© 2019 McGraw-Hill Education


Graph Models:
Computer Networks - Appendix 1

The vertices are San Francisco, Los Angeles, Denver. Chicago, Detroit, New York, and
Washington. The edges are from San Francisco to Los Angeles, from San Francisco to
Denver, from Los Angeles to Denver. From Denver to Chicago, from Chicago to Detroit,
from Chicago to Washington. From Chicago to New York. From Detroit to New York,
and from Washington to New York.

Jump to the image


© 2019 McGraw-Hill Education
Graph Models:
Computer Networks - Appendix 2

2 edges between Los Angeles and Denver, 3 edges between Denver and Chicago, 2
edges between Chicago and New York, and 2 edges between New York and
Washington.

The vertices are San Francisco, Los Angeles, Denver. Chicago, Detroit, New York, and
Washington. The edges are directed from San Francisco to Los Angeles, from San
Francisco to Denver. From Los Angeles to Denver, from Denver to Los Angeles. From
Denver to Chicago, from Chicago to Denver. From Chicago to Detroit, from Detroit to
Chicago. From Chicago to Washington, from Washington to Chicago. From Chicago to
New York, from Detroit to New York, and from Washington to New York.

The vertices are San Francisco, Los Angeles, Denver. Chicago, Detroit, New York, and
Washington. The edges are directed from San Francisco to Los Angeles, from Los
Angeles to San Francisco. 2 from San Francisco to Denver, from Denver to San
Francisco. From Los Angeles to Denver, from Denver to Los Angeles. 2 from Denver to
Chicago, 2 from Chicago to Denver. From Chicago to Detroit, from Detroit to New York,
2 from Chicago to New York. From Chicago to Washington, from Washington to
Chicago. And 2 from Washington to New York.

Jump to the image


© 2019 McGraw-Hill Education
Graph Models: Social Networks - 2

Appendix
The vertices are Kamini, Jan, Lila. Joel, Kari, Paula. Liz, Gail, Eduardo. Amy, Todd, Steve,
Shaquira, Koko, Kamlesh, Ching. The edges are from Kamini to Jan, from Jan to Lila,
Joel, and Paula. From Lila to Joel, Paula, Liz, and Gail. From Joel to Kari, Paula, and Gail.
From Gail to Shaquira. From Paula to Eduardo, Todd, Amy, and Liz. From Liz to Amy and
Steve. From Steve to Amy, Todd, Koko, and Shaquira. From Todd to Amy and Kamlesh.
And from Kamlesh to Ching.

The vertices are Linda, Brian, Deborah, Fred, and Yvonne. The edges are directed from
Deborah to Linda, Brian, and Fred. From Brian to Linda. From Fred to Brian. From
Yvonne to Fred. From Brian to Yvonne, and from Yvonne to Brian.

Jump to the image


© 2019 McGraw-Hill Education
Software Design Applications - 1

Appendix
The vertices are main, display, parser, protocol. Abstract syntax tree, page, and
network. The edges are directed from main to display, parser, protocol, and abstract
syntax tree. From display and parser to abstract syntax tree. From parser and protocol
to page. And from protocol to network.

Jump to the image


© 2019 McGraw-Hill Education
Software Design Applications - 2

Appendix
The vertices are from S 1 through S 6. Each vertex stands for an equation. S 1 is for
a:=0, S 2 is for b:=1, S 3 is for c:=a+1. S 4 is for d:=b+a. S 5 is for e:=d+1. And S 6 is for
e:=c+d. S 1 and S 2 are located at the bottom of the graph, S 3 and S 4 are in the
middle, and S5 and S 6 are at the top. The edges are directed from S 1 to S 3, S 4, S 5,
and S 6. From S 2 to S 4, S 5, and S 6. From S 3 to S 6. And from S 4 to S 5 and S 6.

Jump to the image


© 2019 McGraw-Hill Education
Biological Applications - Appendix 1

The vertices are Raccoon, Hawk, Owl. Opossum, Squirrel, Crow. Shrew, Mouse, and
Woodpecker. The edges are from Raccoon to Hawk, Owl, and Squirrel. From Hawk to
Owl and Crow. From Owl to Crow. From Squirrel to Crow, Opossum, and Woodpecker.
From Woodpecker to Opossum and Shrew. And from Shrew to Opossum and Mouse.

Jump to the image


© 2019 McGraw-Hill Education
Biological Applications - Appendix 2

The vertices are Q9Y3A5, RRP43, RRP42. RRP4, RRP41, RRP44. And RRP40, RRP46 and
PM/Sci2. The edges are from Q9Y3A5 to RRP43, RRP42, RRP4, and RRP41. From RRP43
to RRP42, RRP41, and RRP4. From RRP42 to RRP4 and RRP41. From RRP4 to RRP41,
RRP46, RRP44, and PM/Sci2. From RRP41 to RRP44, RRP46, RRP40, and PM/Sci2. And
from RRP46 to RRP40 and PM/Sci2.

Jump to the image


© 2019 McGraw-Hill Education
Degrees and Neighborhoods of
Vertices - Appendix
Graph G has 7 vertices. A, B, C. D, E, F, and G. The graph has 9 edges. A B, B C, C D. C E,
E F, F A. F B, F C, and B E. Graph H has 5 vertices. A, B, C, D, and E. The graph has 11
edges. A B, B B, B C. B D, B E, A D. 3 D E edges and 2 A E edges.

Jump to the image


© 2019 McGraw-Hill Education
Directed Graphs - Appendix 3

The graph has 12 edges. Arrows point from A to A, from A to B, from A to C. From A to
E, from B to D, from C to B. From C to C, from D to C, from D to E. From E to E, from E
to A, and from E to D.

Jump to the image


© 2019 McGraw-Hill Education
Special Types of Simple Graphs: Cycles
and Wheels - Appendix
C1 is a triangle, C4 is a square, C5 is a pentagon, and C is a hexagon.

Jump to the image


© 2019 McGraw-Hill Education
Special Types of Simple Graphs:
n-Cubes - Appendix
There are 2 points, 0 and 1, connected by a line in graph Q1. In graph Q2, there are 4
points connected by 4 lines forming a square. The points are 00, 10, 11, and 01. Q
subscript 3. In graph Q3, there are 8 points connected by 12 lines forming a cube. The
points at the bottom are 000, 010, 011, and 001. The points at the top are 100, 110,
111, and 011.

Jump to the image


© 2019 McGraw-Hill Education
Special Types of Graphs and Computer
Network Architecture - Appendix
The star graph has 9 vertices and 8 edges. One vertex is in the center, and it is
connected with other vertices by edges. The ring graph has 8 vertices and 8 edges that
form a ring. The hybrid graph has 9 vertices and 16 edges. It has a shape of a star
graph inside a ring graph.

The vertices form a 4 by 4 grid. The first numbers of each vertex represent rows, and
the second numbers represent columns, starting from 0.

Jump to the image


© 2019 McGraw-Hill Education
Complete Bipartite Graphs - Appendix
Graph K 2 3 has 5 vertices. 2 points are at the top, and 3 points are at the bottom. Each
point from the top is connected with each point from the bottom. Graph K 3 3 has 6
vertices. 3 points are at the top, and 3 points are at the bottom. Each point from the
top is connected with each point from the bottom. Graph K 3 5 has 8 vertices. 3 points
are at the top, and 5 points are at the bottom. Each point from the top is connected
with each point from the bottom. Graph K 2 6 has 8 vertices. 2 points are at the top,
and 6 points are at the bottom. Each point from the top is connected with each point
from the bottom.

Jump to the image


© 2019 McGraw-Hill Education
Bipartite Graphs and Matchings -
Appendix
In graph A, the vertices are Alvarez, Berkowitz, Chen, Davis. And requirements,
architecture, implementation, testing. Alvarez is connected with requirements and
testing. Berkowitz is connected with architecture, implementation and testing. Chen is
connected with requirements, architecture, and implementation. Davis is connected
with requirements. In graph B, the vertices are Washington, Xuan, Ybarra, Ziegler. And
requirements, architecture, implementation, testing. Washington is connected with
architecture. Xuan is connected with requirements, implementation, and testing.
Ybarra is connected with architecture. And Ziegler is connected with requirements,
architecture, and testing.

Jump to the image


© 2019 McGraw-Hill Education
New Graphs from Old - Appendix 1

The first graph is complete with 5 vertices. A, B, C, D, and E. The second graph is the
same as previous but with the removed vertex D and corresponding edges. So, the
edges are A B, A C, A E, B C, and B E.

Jump to the image


© 2019 McGraw-Hill Education
New Graphs from Old - Appendix 2

Graph G1 has 5 vertices. A, B, C, D, and E. The graph has 6 edges. A B, B C, C E. E D, D


A, and B E. Graph G2 has 5 vertices. A, B, C, D, and F. The graph has 5 edges. A B, B C, C
F. F B, and B D. Graph G1 union G2 has 6 vertices. A, B, C. D, E, and F. The graph has 9
edges. A B, B C, C F. F B, C E, B E. E D, B D, and D A.

Jump to the image


© 2019 McGraw-Hill Education
Representing Graphs:
Adjacency Lists - Appendix
The graph has 12 edges. Arrows point from A to B, from A to C, from A to D, from A to
E. From B to D, from B to B. From C to A, from C to E, from C to C. From E to B, from E
to C, and from E to D.

Jump to the image


© 2019 McGraw-Hill Education
Representation of Graphs: Adjacency
Matrices - Appendix 3

The graph has 10 edges. 3 A B edges, B C, loop C C. 2 C D edges, B D, and 2 A D edges.

Jump to the image


© 2019 McGraw-Hill Education
Representation of Graphs: Incidence
Matrices - Appendix 2

The graph has 6 edges. V1 V4 labeled E1, V1 V5 labeled E2. V2 V4 labeled E3, V2 V5
labeled E4. V2 V3 labeled E6, and V3 V5 labeled E5.

The graph has 8 edges. 2 V1 V2 edges labeled E2 and E3. V2 V3 labeled E4, V3 V5
labeled E5, V2 V5 labeled E6, and V2 V4 labeled E7. There is a loop at vertex V1,
labeled E1, and at vertex V4, labeled E8.

Jump to the image


© 2019 McGraw-Hill Education
Isomorphism of Graphs - Appendix 2

Graph G has 4 vertices. U1, U2, U3, and U4. The graph has 4 edges. U1 U2, U2 U4, U3
U4, and U3 U1. Graph H has 4 vertices. V1, V2, V3, and V4. The graph has 4 edges. V1
V3, V1 V4, V2 V3, and V2 V4.

Jump to the image


© 2019 McGraw-Hill Education
Isomorphism of Graphs - Appendix 4

Graph G has 8 vertices. A, B, C, D. E, F, G, and H. The graph has 10 edges. A B, A D, B C.


B F, C D, D H. E F, E H, F G, and G H. Graph H has 8 vertices. S, T, U, V. W, X, Y, and Z. The
graph has 10 edges. S T, S V, T U. U V, V Z, W X. W Z, X Y, and Y Z.

Subgraph of G has 4 vertices. B, D, F, and H. The graph has 2 edges. B F and D H.


Subgraph of H has 4 vertices. S,V, W, and Z. The graph has 4 edges. S V, S W, W Z, and Z
V.

Jump to the image


© 2019 McGraw-Hill Education
Isomorphism of Graphs - Appendix 5

Graph G has 6 vertices labeled from U1 to U6. The graph has 7 edges. U1 U2, U1 U4,
U2 U3. U2 U6, U3 U4, U4 U5, and U5 U6. Graph H has 6 vertices labeled from V1 to V6.
The graph has 7 edges. V1 V2, V1 V5, V2 V3. V3 V4, V3 V6, V4 V5, and V5 V6.

Jump to the image


© 2019 McGraw-Hill Education
Connectedness in Undirected Graphs -
Appendix
Graph G1 has 7 vertices. A, B, C. D, E, F, and G. The graph has 8 edges. A B, A C, B C. C
D, C F, F D. F G and D E. Graph G2 has 6 vertices. A, B, C. D, E, and F. The graph has 5
edges. A B, A C, D E. D F and E F.

Jump to the image


© 2019 McGraw-Hill Education
Connected Components - Appendix
The graph has 6 edges. Edges A C, A B, and B C are in H1 area. Edge D E is in H2 area.
Edges F G and G H are in H3 area.

Jump to the image


© 2019 McGraw-Hill Education
Connectedness in Directed Graphs - 2

Appendix
Graph G has 5 vertices. A, B, C, D, and E. The graph has 6 edges. Arrows point from A
to B, from B to C, from B to D. From C to D, from D to E, and from E to A. Graph H has 5
vertices. A, B, C, D, and E. The graph has 6 edges. Arrows point from B to A, from B to
C, from C to D. From D to B, from D to E, and from E to A.

Jump to the image


© 2019 McGraw-Hill Education

You might also like