You are on page 1of 9

9/28/2010

Reference materials
• C.L.Liu, “Introduction to Combinatorial Mathematics”, McGraw-Hill (1968)
• J.L.Gross and J.Yellen, “Graph Theory and its Applications,” Second Edition (Discrete
Mathematics and Its Applications), Chapman & Hall/CRC, 2005.
• F. Buckley and M. Lewinter, “ A Friendly Introduction to Graph Theory, Prentice
ECE-256a •
Hall”, 2002.
J.M.Aldous, R.J.Wilson, “Graphs and Applications: An Introductory Approach” (with
lecture 2 CD-ROM), Springer; 1st ed. 2000. Corr. 3rd printing edition (February 10, 2003)
– G
Gary Chartrand,
Ch t d IIntroductory
t d t G
Graph
h Th
Theory, D
Dover P
Publications;
bli ti U
Unabridged
b id d edition
diti
(December 1, 1984)
– R. J. Trudeau, Introduction to Graph Theory (Dover Books on Advanced Mathematics)
Malgorzata Marek-Sadowska Dover Publications; 2Rev Ed edition (February 9, 1994)
Electrical and Computer Engineering Department • And many more books on combinatorial mathematics and graph theory

Engineering I, room 4111


mms@ece.ucsb.edu.

256a 2
256a 1

Graph Theory Some terminology


Incidence: edge is incident on its vertices. B
• Graph G(V,E) consists of 2 sets:
e1 C
Vertex adjacency: vertices u,v, are e2
V= finite set of vertices {v}
adjacent if e=(u,v) ε E. A e3
D
E=set of edges {e}
Simple graph: graph with no parallel edges or self loops.
loops
• Undirected
U di t d graph
h
Each edge e ε E associated with an unordered pair Degree of vertex: d(v) = number of edges incident to v.
of vertices:
Path: sequence of edges {ei, ei+1, …}
u e v
e = (u,v)
Euler path: path which contains each edge once and only
once.
256a 3 256a 4

E
e4 Connected graph: if for every u,v ε V there exists E
B
Path length: number of edges in the path. e8
e9 A path from u to v. B
In G1: {e1,e4,e9,e7,e5} – path of length 5. e1 e2 C
e7 F
e6 C
e3 F
Circuit – closed path. A e5
D
E A D
G1 Subgraph G’ of G:
Acyclic graph: graph with no cycles (ex. G2). B G4

e1 C G’(V’,E’): V’ V, E’ E, such that an edge {u,v} ε E’,


e2 F
E
A e3 only if (u,v) ε E. (G5 is a subgraph of G4)
D B
G2
Euler circuit: circuit which contains each edge once and only once. Proper subgraph: E’ E, V’ V. F
Example: E
e4 A D
e10 B {e10,e4,e1,e2,e9,e8,e7, ( G5 is also a proper subgraph of G4.
e8 e6, e3, e12, e5,e11} G5
e9
e1 e2 C
e7 F e11
e6
A e3 e5
D
G3 e12
256a 5 256a 6

1
9/28/2010

Spanning subgraph: subgraph with V=V’. E Maximal subgraph G’ of G w.r.t. some property P: if G’
B
has the property P, and G’ is not a proper subgraph of any
C
F
other subgraph of G having the property P.
A D
Component of G: maximal G6 Component of G: maximal
connected subgraph of G. c2 connected subgraph of G. c2
E E
B B

c1 c1
C F C F
A D A D
H H

I I

256a 7 256a 8

Minimal subgraph G’ of G w.r.t. some E Directed graph (digraph): D(V,E)


property: G’ has the property P, and B

no subgraph of G having the property C


E=directed edges or arcs; e= (u,v) is an ordered pair of
F vertices.
P is a proper subgraph of G’.
A D
Example: The subgraph induced by the
red edges in G is a minimal spanning G u v
subgraph of G.
Directed path: sequence of arcs { (u,v), (v,w)….}

Example: The subgraph induced by the E


Directed circuit (cycle): closed directed path.
red edges in G1 is a minimal connected B
spanning subgraph of G1.
C
F Acyclic digraph: digraph with no directed circuits.
A D

G1

256a 9 256a 10

In-degree:
d − (v); Γ − (v) = {w | ( w, v ) ∈ E}
v Strongly connected:if there is a directed path u->v
and v->u for all vertices in D.
Out-degree: v (All vertices are strongly connected)
d + (v ); Γ + (v ) = {w | (v, w) ∈ E}

For every graph:

|v| |v|

d (vi ) =  d + (vi )
i =1 i =1

256a 11 256a 12

2
9/28/2010

Strongly connected component: Cutset of a connected graph:

Minimal set of edges S in G whose removal


maximal strongly connected subgraph. From G disconnects G, I.e. G-S is disconnected,
And has exactly 2 components.
Minimally connected:

If D is strongly connected and removal


of any edge destroys the “strongly C2
connected” property. C1

Cutset of minimum cardinality = min cutset.

256a 13 256a 14

Cut: set of edges having one end vertex in V1, and The first graph
the other in V2, and
The bridges of Konigsberg
∪ =V
V1 ∩V2 = 0, V1 V2 C
C
D D
Min-cut = cut of minimum cardinality A

v1 v2 A
This is a cut
cut, but not a cut
cut-set
set B
(not a minimal set of edges).
v3
v4 v5
B

Resultant graph has 3 connected components, Problem: Start at any of the four land areas, walk through each bridge
v1 v2 exactly once, and return to the starting point ( Euler circuit).
not 2.
v3
v4 v5

256a 15 256a 16

Special graphs Regular graph: k-regular, if all v ∈have


V d(v)=k.

Complete graph n(n − 1) 5-regular, also K6


K n has | E |=
2
Note: Kn is (n-1) regular.
K6
Clique of G: set of vertices S ⊆, such
V that
the induced subgraph of G on S is a complete Bipartite graph: graph whose vertices can be
graph.
h divided into two sets such that no edges connect
vertices in the same set.
Clique problem: determine if a given
simple graph has a clique of size k.

256a 17 256a 18

3
9/28/2010

Complete bipartite graph: km,n K-partite graph: vertices V partitioned into k


if |V1|=m, |V2|=n and there is an edge between every subsets: V1 ,V2 ,Vs.t.
k each edge has one
pair if vertices v1 ∈ V
, 1 v2 ∈ V2 vertex in some Vand i the other in . V j

3-partite graph.

V1 V2 V1 V2
Complete bipartite Bipartite graph.
graph.

256a 19 256a 20

Basic graph theorems


Isomorphism
The sum of the degrees = 2 x the number of edges.
Graphs represent structural relations between n
 d (vi ) = 2 E
vertices. i −1

Two graphs G and H are isomorphic, if there is The number of vertices of odd degree is even.
a one-to-one
one to one correspondence between their sets A graph G has an Euler path if and only if it is connected
of vertices and their sets of edges, such that the and has two or no vertices of odd degree.
corresponding edges of G,H are incident on the
corresponding vertices of G,H, A graph G has an Euler circuit if and only if it is connected
and all vertices or of even degree.

256a 21 256a 22

In an acyclic digraph D there is at least one vertex Directed Euler Path


u with d in (u ) = 0and at least one vertex v with A directed graph contains an Euler path, iff its
d out (u ) = 0 underlying graph is connected and contains one
vertex , a, such that
d out ( a ) = d in (a ) + 1
Directed Euler circuit and at most one vertex, b, such that
d in (b) = d out (b) + 1
A directed graph contains an Euler
circuit if and only if its underlying graph is while for all other vertices, v
connected and, for all vertices v :
d out (v) = din (v)
d out (v) = d in (v)

256a 23 256a 24

4
9/28/2010

Hamiltonian Circuit: a circuit in which Related problem:


every vertex appears once and only once.
Traveling Salesman Problem
Dodecahedron
(Hamilton 1857) Visit all cities exactly once and return to starting point
traveling minimum distance.

Find
Fi dHHamiltonian
ilt i circuit
i it off minimum
i i llength
th iin a given
i
weighted graph.
Hamiltonian path: a path in which every vertex
Vertex: city to be visited
appears once and only once. No efficient
Edge: road between 2 cities
techniques exist for finding Hamiltonian W(e): length of the road.
circuits in a graph.
TSP : min  w(e)
256a 25 256a 26

A necessary condition that a bipatrite graph has Trees


a Hamiltonian circuit is that it has the same
number of vertices in each set. A tree is a connected graph with no circuits.

A complete (directed) graph is one which has a


(directed) edge between every pair of vertices.

A spanning tree of a graph is a tree which


contains all the vertices of the graph.
Every complete directed graph has a Hamiltonian
path.

256a 27 256a 28

Minimum spanning tree theorem Minimum spanning tree


If Prim’s algorithm
• the vertices of a graph, G, are divided into
two disjoint sets, A and B; and 1. Draw in shortest edge

• e is the minimum length edge with one vertex 2. Thereafter, draw in shortest edge which does
in A and another in B not complete a circuit.

2
then there exists a minimum spanning tree, 12 2
12
T, which contains e. 10 3 5 3 5
10
10 10
B 8 8
A e e is the min length edge.

256a 29 256a 30

5
9/28/2010

Shortest path in a directed graph Dijkstra’s Algorithm

1. Set L(S) = 0, rest L(v) = ∞


2. Find unmarked vertex u such that L(u) = min.
6 If u = T, STOP.
3. For each e = (u,v), set
4 2 2 L(v)=min(L(v), L(u) + l(e))
2 3 4. Mark u, go to 2.
7
3 7 T
S
4
(4) 6 (7)
2 3 2
5 6
4 2 2
6 7 2 3
S T
3 (3) (5) 7
4 (8)
2 3 2
5 6
(2) 6 (6)
256a 31 256a 32

Shortest path in a directed graph Shortest path in a directed graph

∞ 6 ∞ 4 6 ∞

4 2 2 4 2 2
3 3
0 7 2
7 ∞ 0 3
7 2
7 ∞
3 3
S
∞ 4 ∞ T 4 ∞
2 3 2 2 3 2
5 6 5 6

∞ 6 ∞ 2 6 ∞

256a 33 256a 34

Shortest path in a directed graph Shortest path in a directed graph

4 6 ∞ 4 6 ∞

4 2 2 4 2 2
3 3
0 3
7 2
7 ∞ 0 3
7 2
7 ∞
3 3
4 7 4 7
2 3 2 2 3 2
5 6 5 6

2 6 2 6
8 8

256a 35 256a 36

6
9/28/2010

Shortest path in a directed graph Shortest path in a directed graph

4 10 4 10
6 6

4 2 2 4 2 2
3 3
0 3
7 2
7 ∞ 0 3
7 2
7 ∞
3 3
4 7 4 76
2 3 2 2 3 2
5 6 5 6

2 6 2 6
8 7 8 7

256a 37 256a 38

Shortest path in a directed graph Shortest path in a directed graph

4 10 4 10 9
6 6

4 2 2 4 2 2
3 3
0 3
7 2
7 ∞ 0 3
7 2
7
13
3 3
4 76 4 76
2 3 2 2 3 2
5 6 5 6

2 6 2 6
8 7 8 7

256a 39 256a 40

Shortest path in a directed graph Shortest path in a directed graph

4 10 9 4 10
6 6 9

4 2 2 4 2 2
7 2 3 7 2 3
0 3 0 3
3 7 3 7 13
76 13 76
4 4
2 3 2 2 3 2 11
5 6 5 6
2 6 2 6
8 7 8 7

256a 41 256a 42

7
9/28/2010

Shortest path in a directed graph Dijkstra’s Algorithm

4 10 9
6
(4) 6 (7)

4 2 2
7 2 3 4 2 2
0 3 2 3
3 7 13
7
S T
4 76 3 ((3)) (5) 7
3 2 11 4
2 (8)
5 6 2 3 2
5 6
2 6 8 7 (2) 6 (6)

256a 43 256a 44

Critical Path Problem Critical path algorithm

In scheduling problem (PERT)


1. Set L(v) – 0, u = S
2. For each e = (u,v), set
• V = events, E = tasks
L(v) = max(L(v), L(u)+l(e))
• l(e) = time needed to complete task e,
3. Repeat 2 for all visited vertices.
• the shortest possible completion time is determined
by the longest (critical) path.
(9)
7 (2) 7
2 3 2 3
S (16)
10 10
T
3 3
4 4
6 (3) 6 (12)
Find the longest path in directed graph.

256a 45 256a 46

Independent Sets
An independent set is maximal if the addition
A set of vertices of any graph is an independent set if
of any other vertex causes it to become
dependent.
and only if no vertices in the set are adjacent.

B C B C The independence number, I(G) of a graph, G,


Is the number of vertices in its largest maximal
A D A
F F D Independent set.
E E

G H B C H
G

A D
F
E

G H
256a 47 256a 48

8
9/28/2010

An independent set is a dominating set if and


only if it is maximal.
B C 0
0
A 0
F D 0
E
0
G H 0
0
0
Non-max independent sets: EH, BFG,AC.
Max independent sets: ACH, BDFG.
A maximal independent set on the chessboard
In any graph G: I(G)>=D(G).

256a 49 256a 50

The covering problem A row (column) covers a second row (column) if


it has ones everywhere the second does.

Given a binary matrix, find the smallest set of rows which


1 0 1 1 0 covers 1 0 0 1 0
covers a 1 in each column.
1 0
1 1 0 1 1 0
does not
1 1 1 0 0 0 Smallest covering 0 1
cover
Covering set 0 1 0 1 1 0 set.
0 1 1 1 0 1 0 0
1 0 1 1 0 1
1 0

1 1

256a 51 256a 52

If a column a covers column b, column a may be eliminated If row a covers row b, row b can be eliminated
U V W X Y Z U W Y Z
A 1 0 0 1 1 0 A 1 0 1 0 1 0 U W Y Z W Y Z
B 1 1 1 0 0 0 B 1 1 0 0 0 0 A A 0 1 0
1 0 1 0 1 0
C 0 1 0 1 1 0 C 0 0 1 0 1 0 B 1 1 0 0 0 0
U B 1 0 0 D covers B and E
Covers
D 0 1 1 1 0 1 D 0 1 0 1 0 1
C 0 0 1 0 1 0Y D 1 0 1
E 1 0 0 1 0 1 E 1 0 0 1 0 1
D 0 1 0 1 0 1 E 0 0 1
E 1 0 0 1 0 1
V covers W
A covers C
X covers Y
W Y Z Smallest covering set : rows A and D
A 0 1 0
D 1 0 1

256a 53 256a 54