Professional Documents
Culture Documents
This Lecture
• Graphs, degrees
• Isomorphism
• Tree
• Eulerian cycle
• Directed graphs
Seven Bridges of Königsberg
Is it possible to walk with a route that crosses each bridge exactly once?
Seven Bridges of Königsberg
Question: Is it possible to find a walk that visits each edge exactly once.
e6 d
e7
e5
e4 v
c
a
e3
e2
e1
b
Suppose there is such a walk, there is a starting point and an endpoint point.
Question: Is it possible to find a walk that visits each edge exactly once.
e6 d
So, at most two vertices can
e7 have odd number of edges.
e5
e4
c In this graph, every vertex has
a only an odd number of edges,
e3
e2 and so there is no walk which
e1
visits each edge exactly one.
b
Suppose there is such a walk, there is a starting point and an endpoint point.
When is it possible to have a walk that visits every edge exactly once?
When is it possible to have a walk that visits every edge exactly once?
When is it possible to have a walk that visits every edge exactly once?
When is it possible to have a walk that visits every edge exactly once?
Eulerian path
• Graphs, degrees
• Isomorphism
• Tree
• Eulerian cycle
• Directed graphs
Types of Graphs
a
b
A graph G=(V,E) consists of:
A set of vertices, V f
A set of undirected edges, E
c
• V(G) = {a,b,c,d,e,f} e
d
• E(G) = {ad,af,bd,be,cd,ce,df}
G
An edge uv is incident on a
b
the vertex u and the vertex v.
f
The neighbour set N(v) of a vertex v
is the set of vertices adjacent to it. c
e.g. N(a) = {d,f}, N(d) = {a,b,c,f}, N(e) = {b,c}. e
d
degree of a vertex = # of incident edges
e.g. deg(d) = 4, deg(a)=deg(b)=deg(c)=deg(e)=deg(f)=2.
2 1
Is there a graph with degree sequence (2,2,2,2,1)?
Where to go?
NO. What’s wrong with these sequences?
Handshaking Lemma
Lemma.
2|E | deg(v )
v V
Lemma.
2|E | deg(v )
v V
• Graphs, degrees
• Isomorphism
• Tree
• Eulerian cycle
• Directed graphs
Same Graphs?
99
306 67
99 67 306 145
Same graph (different labels)
306 67 Christos
Sonya
99 Jessica
Graph Isomorphism
Informally, two graphs are isomorphic if they are the same after renaming.
one-to-one mapping
Hay
Dog Pig
Corn
one-to-one mapping
Hay
Dog Pig
Corn
If there is an edge in the original graph, there is an edge after the mapping.
Are These Isomorphic?
one-to-one mapping
Hay
Dog Pig
Corn
If there is no edge in the original graph, there is no edge after the mapping.
Graph Isomorphism
one-to-one mapping f: V1 → V2
u —v in E1 iff f (u)—f (v) in E2
• If G1 and G2 are isomorphic, do they have the same number of vertices? YES
• If G1 and G2 are isomorphic, do they have the same number of edges? YES
• If G1 and G2 are isomorphic, do they have the same degree sequence? YES
Non-isomorphic
• Graphs, degrees
• Isomorphism
• Tree
• Eulerian cycle
• Directed graphs
Paths
13 12 26 16 66
E17
E25
10 4 8
3 connected components
a
v
w
v
w
u v
This Lecture
• Graphs, degrees
• Isomorphism
• Tree
• Eulerian cycle
• Directed graphs
Tree
leaf
leaf
Claim. In a tree, there is a unique simple path between every pair of vertices.
Tree Characterization by Number of Edges
v Look at a leaf v.
Characterization by paths:
• Graphs, degrees
• Isomorphism
• Tree
• Eulerian cycle
• Directed graphs
Eulerian Graphs
Note that the edges can be partitioned into five simple cycles.
The idea is that we can construct an Eulerian cycle by adding cycle one by one.
The idea is that we can construct an Eulerian cycle by adding cycle one by one.
1 6
2 3 5
9
1 10
2 6 8
3 5
7
4
We can “detour” to the third cycle before finishing the second cycle.
Eulerian Cycle
13
1 14 10
2 6 12
3 5 11 9
7
4 8
15
16 12
13
1 14 10 9
14
2 6 12 10
3 5 11 9
13 11
7
4 8
15
1 16 12 9
2 6 14 10
3 5 13 11
7
4 8
C* C
Remove the edges in C from the graph G and call the new graph G’.
So the original graph G can be partitioned into simple cycles, C, C 1, C2, …, Ck.
Proof
• Graphs, degrees
• Isomorphism
• Tree
• Eulerian cycle
• Directed graphs
Directed Graphs
a
b
A directed graph G=(V,A) consists of:
A set of vertices, V f
A set of directed edges (arcs), A
c
• V(G) = {a,b,c,d,e,f} e
d
• A(G) = {da, fa, db, eb, dc, ec, fd}
G
For an arc uv, we say u is the tail of the arc and v is the head of the arc.
u v
In-Degrees and Out-Degrees
a
b
The out-degree of a vertex v is the number of
arcs with v being tail; similarly, the in-degree of f
A directed cycle is a directed path that begins and ends with same vertex.
a
v
w
A simple directed cycle is a directed cycle with no repeated vertices except the last.
Eulerian Problem in Directed Graphs