Professional Documents
Culture Documents
Definitions
def: A vertex is a point, e.g. in 3space, def: An edge is a space curve (without self-intersections) joining a vertex to itself or to another vertex. Such vertices are called endpoints of the edge. def: Two vertices are adjacent if there is an edge joining them. def: A graph is a collection of vertices (V) and edges (E).
2
Edges
Undirected Undirected Undirected Directed Directed
If multiple connection are possible between two machines, we would have a multigraph If a connection can only be one-way, then we would have a directed (multi)graph.
9
Summary
Type of graphs
Simple Graph Multigraph Pseudograph Directed Graph Directed Multigraph
10
Adjacency and The Degree of a Vertex Two vertices u and v in an undirected graph G are called adjacent (or neighbours) if {u, v} is an edge of G. If e = {u, v} (more precisely, f(e) = {u, v}), the edge e is called incident with u and v. The edge e is also said to connect u and v. The vertices u and v are called endpoints of the edge {u, v}. 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 twice to the degree of that vertex. The degree of the vertex v is denoted by deg(v).
12
Example 1
What are the degrees of the vertices in the following graph?
b c d
Vertex of degree zero is called isolated. Vertex of only 1 degree is called pendant. d is pendant and g is isolated.
13
This theorem shows that the sum of the degrees of the vertices of an undirected graph is even.
14
Example 2
How many edges are there in a graph with seven vertices each of degree four?
The sum of the degrees of the vertices is 4.7 = 28. 2e = 28, e = 14.
15
Theorem
An undirected graph has an even number of vertices with odd degrees.
In a directed graph, the in-degree of a vertex v, denoted by deg(v), is number of edges with v as their terminal vertex. The out-degree of v, denoted by deg+(v), is the number of edges with v as their initial vertex.
Theorem: Let G = (V, E) be a directed graph. Then deg(v) = deg(v) = |E|
vV vV
16
Complete Graph
The complete graph on n vertices, denoted by Kn , is the simple graph that contains exactly one edge between each pair of distinct vertices. K1 K3 K5
17
K2 K4
Cycles
The cycle Cn, n u3, consists of n vertices v1, v2, , vn and edges {v1, v2}, {v2, v3}, , {vn-1, vn}, {vn, v1}. C3 C5 C4 C6
18
Wheels
We obtain the wheel Wn when we add an additional vertex to the cycle Cn , and connect this new vertex to each of the n vertices in Cn. W3 W5 W4 W6
19
n-Cubes
The n-dimensional cube, n-cube, denoted by Qn , is the graph that has vertices representing the 2n bit strings of length n. Two vertices are adjacent if and only if the bit string s that they represent differ in exactly one position. Q1
0 1
Q2
10 11
Q3
100
111
00
01
011
20
Subgraph
A subgraph of a graph G = (V, E) is a graph H = (W, F) where W V and F E. Example: S is a subgraph of K5
a e d K5 c S b e c a b
21
Summary
Adjacency and The Degree of a Vertex The Handshaking Theorem Complete Graph Cycles Wheels n-Cubes Subgraph
22
Adjacency List Representation DEF: An adjacency list for a vertex v of a graph G is a list containing each vertex w of G once for each edge between v and w. DEF: An adjacency list representation of a graph is a table of all the adjacency lists.
24
Adjacency Lists
Examples:
b a e
Initial Vertex
Vertex
a b c d e
Adjacent Vertices b, c, e a a, d, e c, e a, c, d
c d
Terminal Vertex
b a e d
25
a b c d e
b, e b a, d, c, e -
Adjacency Matrices
Suppose G = (V, E) is a simple graph where |V| = n. The adjacency matrix A (or AG) of G is the n v n zero-one matrix. Matrix AG = [aij], where
aij =
1 if {vi , vj} is an edge of G 0 otherwise
26
b c d b c
1 1 0 0 0 0 0 0 1 0
Adjacency matrix
a a b c d e
0 1 1 0 1
Adjacency matrix
d e
0 0 1 0 0 1 0 0 1 0
b c
1 0 0 0 0 1 0 0 1 1
d e
0 0 1 0 1 1 0 1 1 0
27
Graph Isomorphism
The Greek root iso means same . The Greek root morphism means form . DEF: The Simple graphs G1=(V1, E1) and G2=(V2, E2) are isomorphic if there is a one-to-one and onto (bijection) 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 inV1 .
30
Isomorphism
Example: Determine if the graphs G = (V, E) and H = (W, F) below are isomorphic. Give the possible correspondence.
a G c 1 3 H d 2 4 b The function f(a) = 1, f(b) = 4, f(c) = 3, f(d) = 2 is a 1-to-1 and onto correspondence between V and W. This also preserves adjacency where (a, b) = (1, 4); (a, b) = (1, 3) and so on Hence, the graphs are isomorphic and the possible correspondence is: a-1, b-4, c-3 and d-2.
31
Graphs that are not isomorphic are called invariant. To be isomorphic, three properties should be met. Graph G1=(V1, E1) is isomorphic to graph G2=(V2, E2) iff:
|V1| = |V2|, and |E1| = |E2|.
The number of vertices with degree n is the same in both graphs. For every proper subgraph g of graph G1, there is a proper subgraph of graph G2 that is isomorphic to g.
32
Isomorphism Example
If isomorphic, label the 2nd graph to show the isomorphism, else identify difference.
b a d e f c c b d a e f
33
d c
34
Summary
Adjacency List Representation Adjacency Lists Adjacency Matrices Adjacency Matrix Representation Adjacency Matrix for Pseudographs Graph Isomorphism Graph Invariants
35
9.4 Connectivity
TMC 1813 Discrete Mathematics
Announcements
No more Discussion slots. Replacement class is on for this week FRIDAY 22 OCT 2010 730 pm 930 pm @ DK, CTF!
37
8.4: Connectivity
In an undirected graph, a path of length n from u to v is a sequence of adjacent edges going from vertex u to vertex v. A path is a circuit if it begins and ends at the same vertex that is u=v and has length greater then zero. A path or circuit is also called simple if it does not contain the same edge more then once. A path traverses the vertices along it.
38
8.4: Connectivity
a b c
39
8.4: Connectivity
a b c
6/12/2011 40
yes no yes no
41
Connectedness
An undirected graph is connected iff there is a path between every pair of distinct vertices in the graph. Theorem: There is a simple path between any pair of vertices in a connected undirected graph. Connected component: disjoint connected subgraphs A cut vertex or cut edge separates 1 connected component into 2 if removed.
42
Connectedness
What are the connected components of the graph H shown below? b H1 H2 d a c e h g f H3
The graph H is the union of the three disjoint connected subgraphs H1, H2 and H3. These 3 subgraph are the connected components of H
43
Directed Connectedness
A directed graph is strongly connected iff there is a directed path from a to b for any two vertices a and b. It is weakly connected iff the underlying undirected graph (i.e., with edge directions removed) is connected. Note strongly implies weakly but not vice-versa. Any strongly connected directed graph is also weekly connected.
44
Directed Connectedness
Are the directed graphs G and H shown in figure 5 strongly connected? Are they weekly connected
b c
b c
e G
e H
d
Weakly connected
45
46
Let A be the adjacency matrix of graph G. The number of paths of length k from vi to vj is equal to (Ak)i,j.
The notation (M)i,j denotes mi,j where [mi,j] = M.
47
Example
How many paths of length 4 are there from a to d in the simple graph a below?
48
A=
1 0 0 1 1 0 0 1 0 1 1 0
49
A = 0 8 8 0
0 8 8 0 8 0 0 8 From the graph it could be observed that there are exactly 8 paths of length 4 from a to d. What are the paths?
G1 Euler Circuit
G2
G3 Euler Graph
53
Hamiltons Circuit
Which of these graph has a Hamilton circuit and which one has a Hamilton path?
Hamilton circuit
e d G1
d G2
Hamilton path
54
Equivalent multigraph
55
Theorem: Theorem A connected multigraph has an Euler path (but not an Euler circuit) iff it has exactly 2 vertices of odd degree.
One is the start, the other is the end.
56
57
58
Dodecahedron puzzle
Equivalent graph
Pegboard version
59
60
61
9.1 pg. 596 6, 8, 16, 26 9.2 pg. 608 8, 10, 20, 54 9.3 pg. 618 4, 8, 12, 14, 18, 22, 36, 40
62
FIN!
Tutorial Following week! 9.4 pg.629
4, 8, 14, 20, 24
9.5 pg.643
8, 14, 18, 24, 30, 32, 38, 42, 44
63