Graph Theory-Ch.5

Graph Theory
Chapter 5
Fundamental Concept
1.1 What Is a Graph?
1.2 Paths, Cycles, and Trails
1.3 Vertex Degree and Counting
1.4 Directed Graphs
1
Graph Theory
The KÖnigsberg Bridge Problem
 Königsber is a city on the Pregel river in Prussia
 The city occupied two islands plus areas on both
banks
 Problem:
Whether they could leave home, cross every
bridge exactly once, and return home.
X
W
Z
Y
2
Graph Theory
A Model
 A vertex : a region
 An edge : a path(bridge) between two regions
e1
X
X
e6
e2
W
W
Z
Y
e3
e4
Y
e5
e7
Z
3
Graph Theory
General Model
 A vertex : an object
 An edge : a relation between two objects
Committee 2
Committee 1
common
member
4
Graph Theory
What Is a Graph?
 A graph G is a triple consisting of:
– A vertex set V(G )
– An edge set E(G )
– A relation between an edge and a pair of
vertices
X
e1
e2
W
e3
e6
e4
e5
Y
e7
Z
5
Graph Theory
Loop, Multiple edges
 Loop : An edge whose endpoints are equal
 Multiple edges : Edges have the same pair of
endpoints
Multiple
edges
loop
6
Graph Theory
Simple Graph
 Simple graph : A graph has no loops or multiple
edges
Multiple
edges
loop
It is not simple.
It is a simple graph.
7
Graph Theory
Adjacent, neighbors
 Two vertices are adjacent and are neighbors
if they are the endpoints of an edge
 Example:
– A and B are adjacent
– A and D are not adjacent
B
A
C
D
8
Graph Theory
Subgraphs
 A subgraph of a graph G is a graph H such that:
– V(H)  V(G) and E(H)  E(G) and
– The assignment of endpoints to edges in H is
the same as in G.
9
Graph Theory
Subgraphs
 Example: H1, H2, and H3 are subgraphs of G
b
a
c
G
e
d
b
a
H1
c
d
H2
a
H3
c
e
e
d
b
d
10
Graph Theory
Finite Graph, Trivial Graph
 Finite graph : an graph whose vertex set and
edge set are finite
 Trivial graph : the graph with one vertex and
no edges, i.e. a single point.
11
Graph Theory
Complement
 Complement of G: The complement G’ of a
simple graph G :
– A simple graph
– V(G’) = V(G)
– E(G’) = { uv | uv E(G) }
u
u
G
y
v
y
v
G’
x
w
x
w
12
Graph Theory
Bipartite Graphs
 A graph G is bipartite if V(G) is the union of
two disjoint independent sets called partite
sets of G
 Also: The vertices can be partitioned into two
sets such that each set is independent
 Matching Problem
 Job Assignment Problem
Workers
Boys
Girls
Jobs
13
Graph Theory
Walks, Trails
1.2.2
 A walk : a list of vertices and edges v0, e1,
v1, …., ek, vk such that, for 1  i  k, the edge ei
has endpoints vi-1 and vi .
 A trail : a walk with no repeated edge.
14
Graph Theory
Path and Cycle
 Path : a sequence of distinct vertices such
that two consecutive vertices are adjacent
– Example: (a, d, c, b, e) is a path
– (a, b, e, d, c, b, e, d) is not a path; it is a walk
 Cycle : a closed Path
– Example: (a, d, c, b, e, a) is a cycle
a
b
c
e
d
15
Graph Theory
Connected and Disconnected
 Connected : There exists at least one path
between two vertices
 Disconnected : Otherwise
 Example:
– H1 and H2 are connected
– H3 is disconnected
b
a
H1
c
d
a
H3
H2
e
d
e
b
c
d
16
Graph Theory
Adjacency, Incidence, and Degree
 Assume ei is an edge whose endpoints are
(vj,vk)
 The vertices vj and vk are said to be adjacent
 The edge ei is said to be incident upon vj
 Degree of a vertex vk is the number of edges
incident upon vk . It is denoted as d(vk)
vj
ei
vk
17
Graph Theory
Adjacency matrix
 Let G = (V, E), |V| = n and |E|=m
 The adjacency matrix of G written A(G), is the
n-by-n matrix in which entry ai,j is the number
of edges in G with endpoints {vi, vj}.
w
b
a
x
y
c
z
e
d
w x
w 0 1
x 1 0
y 1 2
z 0 0
y
1
2
0
1
z
0
0
1
0
18
Graph Theory
Incidence Matrix
 Let G = (V, E), |V| = n and |E|=m
 The incidence matrix M(G) is the n-by-m
matrix in which entry mi,j is 1 if vi is an endpoint
of ei and otherwise is 0.
w
b
a
x
y
c
e
d
z
a
w 1
x 1
y 0
z 0
b
1
0
1
0
c
0
1
1
0
d
0
1
1
0
e
0
0
1
1
19
Graph Theory
Special Graphs
 Complete Graph : a simple graph whose vertices
are pairwise adjacent. [ A graph is complete if
each vertex is connected to every other vertex.]
 The complete graph with n vertices is denoted
by Kn
Complete Graph
20
Graph Theory
Complete Bipartite Graph or Biclique
Complete Bipartite Graph
21
Graph Theory
Paths
 A u,v-walk or u,v-trail has first vertex u and last
vertex v; these are its endpoints.
 A u,v-path: a u,v-trail with no repeated vertex.
 The length of a walk, trail, path, or cycle is its
number of edges.
 A walk or trail is closed if its endpoints are
the same.
22
Graph Theory
Even Graph, Even Vertex1.2.24
 An even graph is a graph with vertex degrees
all even.
 A vertex is odd [even] when its degree is odd
[even].
23
Graph Theory
Regular
 G is regular if (G ) =  (G )
 G is k-regular if the common degree is k.
 The neighborhood of v, written Ng (v ) or N (v )
is the set of vertices adjacent to v.
3-regular
24