Professional Documents
Culture Documents
Dr-Zaguia-CSI2101-W16
Applications of Graphs
Applications of Graphs: Potentially anything (graphs can
represent relations, relations can describe the extension
of any predicate).
Applications in networking, scheduling, flow optimization,
circuit design, path planning.
More applications: Geneology analysis, computer gameplaying, program compilation, object-oriented design,
Dr-Zaguia-CSI2101-W16
Simple Graphs
Simple Graphs: Correspond to symmetric, irreflexive binary relations R.
Degree of a Vertex
deg( v) 2 E
vV
Directed Degree
The degree of v, deg(v):deg (v)+deg (v), is the sum of vs indegree and out-degree.
1
deg (v) deg (v) deg( v) E
2 vV
vV
vV
Dr-Zaguia-CSI2101-W16
K1
K4
K3
K2
K5
K6
Complete graphs Kn
C3
C4
C5
C6
Cycles Cn
Dr-Zaguia-CSI2101-W16
C7
C8
W3
W4
W5
W6
Wheels Wn
Q0
Q1
Q2
Q3
W7
W8
Q4
n-Cubes Qn
Bipartite Graphs
V2
V1
K4,3
Dr-Zaguia-CSI2101-W16
Graph representations:
Adjacency lists.
Adjacency matrices.
Incidence matrices.
Graph isomorphism:
Two graphs are isomorphic iff they are identical
except for their node names.
Dr-Zaguia-CSI2101-W16
Adjacency Lists
Adjacency Lists: A table with 1 row per vertex, listing its adjacent
vertices.
b
a
c
e
f
d
Vertex
a
b
c
d
e
f
Adjacent Vertices
b, c
a, c, e, f
a, b, f
b
c, b
Directed Adjacency Lists: 1 row per node, listing the terminal nodes
of each edge incident from that node.
Dr-Zaguia-CSI2101-W16
10
Adjacency Matrices
c
e
f
d
Can extend to pseudographs by letting each matrix elements be the number
of links (possibly >1) between the nodes.
Dr-Zaguia-CSI2101-W16
11
Incidence Matrices
e4
b
e2
e3
c
e1
d
e
f
1 0
Dr-Zaguia-CSI2101-W16
12
Graph Isomorphism
13
Isomorphism Example
If isomorphic, label the 2nd graph to show the isomorphism, else
identify difference.
d
b
a
e
14
b
Same # of edges
d
c
Different # of
vertices of degree 2!
(1 vs 3)
Dr-Zaguia-CSI2101-W16
15
10.4: Connectivity
16
Directed Connectedness
Dr-Zaguia-CSI2101-W16
17
Dr-Zaguia-CSI2101-W16
18
Equivalent multigraph
The original problem
19
20
Round-the-World Puzzle
Dodecahedron puzzle
Equivalent graph
Dr-Zaguia-CSI2101-W16
21
22
23
Gray Codes
G1 = [0,1]
Gn = [0Gn-1,1Gn-1]
G2 = [0G1,1G1] = [00,01,11,10]
G3 = [0G2,1G2] =
[000,001,011,010,110,111,101,100]
24
Hypercube
Hypercube(defined recursively)
Hypercube of dimension n contains 2n nodes
(binary strings of length n) and each node is
adjacent to n other nodes.
Two nodes are adjacent if they differ by a single
bit.
110
10
11
111
011
010
1
100
00
01
000
Dr Zaguia-CSI2101-W16
101
001
25
111
011
010
100
000
101
001
Dr Zaguia-CSI2101-W16
26
27
Trees as Models
Saturated hydrocarbons
Organizational structures
Computer file systems
Dr-Zaguia-CSI2101-W16
28
29
30
Decision trees
Prefix codes
Huffman coding
Game trees
Dr-Zaguia-CSI2101-W16
31
Depth-first traversal:
Preorder traversal
Inorder traversal
Postorder traversal
Breadth-first traversal
Infix/prefix/postfix notation
Dr-Zaguia-CSI2101-W16
32
Planar Graphs
33
Planar Graphs
-Common Misunderstanding
Dr-Zaguia-CSI2101-W16
34
Dr-Zaguia-CSI2101-W16
35
Proving Planarity
Dr-Zaguia-CSI2101-W16
36
Proving Planarity
3-Cube
Dr-Zaguia-CSI2101-W16
37
Proving Planarity?
4-Cube
38
K5, K3,3
Dr-Zaguia-CSI2101-W16
39
40
Eulers theorem
Proof. By induction.
True if m=0.
If G has a circuit, then delete an edge and
If G has a vertex v of degree 1, then delete v and
Dr-Zaguia-CSI2101-W16
41
Dr-Zaguia-CSI2101-W16
42
Dr-Zaguia-CSI2101-W16
43
Dr-Zaguia-CSI2101-W16
44
Graph Colorings
Vertex coloring of a graph
assign a color to each vertex so that adjacent vertices
are of different colors
i.e. find c: V N such that (u,v) E c(u) c(v)
Chromatic number of a graph G
the least amount of colors needed to color the graph
Dr-Zaguia-CSI2101-W16
45
Graph Colorings
So, what is a chromatic number for
Kn?
Cn?
Km,n?
Bipartite Graphs
The chromatic number of a graph G is 2 if and only if G is
a bipartite graph
Planar Graphs?
Dr-Zaguia-CSI2101-W16
46
47
Dr-Zaguia-CSI2101-W16
48
49