graph theory basics · let’s re-draw it: … and the eulerian trail •cross each of seven...

85
Graph Theory Basics Dr Aamir Hashmi Email: [email protected]

Upload: others

Post on 20-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Graph TheoryBasics

Dr Aamir Hashmi

Email: [email protected]

Page 2: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Graphs

Page 3: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Even: 2𝑘

Odd: 2𝑘 + 1

Basics of Graph Theory

Page 4: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

Page 5: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Suppose we have 5 friends:

Alice, Bob, Carl, Diane, Eve

Basics of Graph Theory

Page 6: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 7: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 8: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 9: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 10: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 11: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 12: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 13: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 14: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 15: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 16: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

Page 17: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

Page 18: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory Even and Odd Degrees

Even: 2𝑘

Odd: 2𝑘 + 1

Page 19: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

This impliesIf a graph has an odd number of nodes,

then the number of nodes with odd degree is even

Because

Odd + Even = Odd|Even degree nodes| + |Odd degree nodes| = |Total nodes|

Page 20: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

Page 21: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

Page 22: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

This impliesIf a graph has an even number of nodes, then the number of nodes with odd degree is even Because

Even + Even = Even|Even degree nodes| + |Odd degree nodes| = |Total nodes|

Page 23: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

Page 24: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Proof

Basics of Graph Theory

Page 25: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Proof

Basics of Graph Theory

Page 26: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Proof

Basics of Graph Theory

|Odd-Degree Nodes| = Even

Even + 2 = Even

Page 27: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Proof

Basics of Graph Theory

|Odd-Degree Nodes| = Even

Even – 2 = Even

Page 28: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Proof

Basics of Graph Theory

|Odd-Degree Nodes| = Even

Odd + 1 = Even

Even + 1 = Odd

Page 29: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Even and Odd Degrees

Basics of Graph Theory

Page 30: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 31: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Practice ProblemsTry to solve at your own

Page 32: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Practice ProblemsTry to solve at your own

Page 33: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Practice ProblemsTry to solve at your own

Page 34: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

GraphsPaths, Cycles and Connectivity

Page 35: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Paths

• Cycles

Page 36: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Recap

• Graph: 𝐺(𝑉, 𝐸) – V: Set of vertices 𝑣0 , 𝑣1 , 𝑣2 ,⋯ , 𝑣𝑛 ,

E: Set of edges 𝑒0 , 𝑒1 , 𝑒2 , ⋯ , 𝑒𝑚

Page 37: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Recap

• Graph: 𝐺(𝑉, 𝐸) – V: Set of vertices 𝑣0 , 𝑣1 , 𝑣2 ,⋯ , 𝑣𝑛 ,

E: Set of edges 𝑒0 , 𝑒1 , 𝑒2 , ⋯ , 𝑒𝑚

• Empty Graph: n vertices and Zero edges

• Complete Graph: 𝐾𝑛: n vertices and All Possible edges

Number of Edges = 𝑛2

=𝑛 𝑛−1

2

Page 38: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Recap

• Graph: 𝐺(𝑉, 𝐸) – V: Set of vertices 𝑣0 , 𝑣1 , 𝑣2 ,⋯ , 𝑣𝑛 ,

E: Set of edges 𝑒0 , 𝑒1 , 𝑒2 , ⋯ , 𝑒𝑚

• Complement of a Graph: ҧ𝐺 𝑉, 𝐸 :

Draw the missing edges, and delete the existing edges (Just take the complement of Edge set E)

Page 39: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Recap

• Graph: 𝐺(𝑉, 𝐸) – V: Set of vertices 𝑣0 , 𝑣1 , 𝑣2 ,⋯ , 𝑣𝑛 ,

E: Set of edges 𝑒0 , 𝑒1 , 𝑒2 , ⋯ , 𝑒𝑚

• Complement of a Graph: ҧ𝐺 𝑉, 𝐸 :

Draw the missing edges, and delete the existing edges (Just take the complement of Edge set E)

Page 40: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Recap• Examples: Verify these at your own

Complement of a Graph: ҧ𝐺 𝑉, 𝐸 :

Draw the missing edges, and delete the existing edges (Just take the complement of Edge set E)

Page 41: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Star Graphs: Take a particular node and connect it to all other 𝑛 − 1 nodes.

This graph has 𝑛 − 1 edges.

Recap

Page 42: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• SubGraphs: Take any part of the graph – it will be Subgraph of the Graph (just like subset of a set)

Recap

Page 43: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Path: Place all the nodes in a row and connect the consecutive nodes – we shall get a chain (or path ) with 𝑛 − 1 edges.

The first and last nodes are called the end points.

End points have degree = 1

Intermediate nodes have degree = 2

Page 44: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 45: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 46: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Basics of Graph Theory

Page 47: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Path: Place all the nodes in a row and connect the consecutive nodes – we shall get a chain (or path ) with 𝑛 − 1 edges.

• If we also connect the first and last node – we complete a circular path – it is called CYCLE.

Page 48: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Path: Place all the nodes in a row and connect the consecutive nodes – we shall get a chain (or path ) with 𝑛 − 1 edges.

• If we also connect the first and last node – we complete a circular path – it is called CYCLE.

We may draw same graph in many ways

Page 49: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Connected Graph: If every two nodes in the graph are connected by a path.

We can reach from any node 𝑎 to a node 𝑏, following a path.

Page 50: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Connected Graph: If every two nodes in the graph are connected by a path.

We can reach from any node 𝑎 to a node 𝑏, following a path.

Page 51: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Connected Graph: If every two nodes in the graph are connected by a path.

We can reach from any node 𝑎 to a node 𝑏, following a path.

Bridge: if we remove this

edge, the graph becomes disconnected

Page 52: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

Example:Connected Graphs on 5 nodes

Page 53: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Walk: A walk in a graph 𝐺 is a sequence of nodes 𝑣0 , 𝑣1 , ⋯ , 𝑣𝑛 which are connected by edges in the given sequence.

It is just like a PATH where nodes may be REPEATED.

Page 54: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Walk: A walk in a graph 𝐺 is a sequence of nodes 𝑣0 , 𝑣1 , ⋯ , 𝑣𝑛 which are connected by edges in the given sequence.

It is just like a PATH where nodes may be REPEATED.

For example:

Page 55: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Walk: A walk in a graph 𝐺 is a sequence of nodes 𝑣0 , 𝑣1 , ⋯ , 𝑣𝑛 which are connected by edges in the given sequence.

It is just like a PATH where nodes may be REPEATED.

For example:

Page 56: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Paths and Cycles(Section 7.2 of textbook)

• Walk: A walk in a graph 𝐺 is a sequence of nodes 𝑣0 , 𝑣1 , ⋯ , 𝑣𝑛 which are connected by edges in the given sequence.

It is just like a PATH where nodes may be REPEATED.

For example:

Page 57: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Eulerian Walk: A walk in a graph 𝐺 such that each edge is visited ONLY ONCE.

Eulerian Walk and Hamiltonian Cycles(Section 7.3 of textbook)

Page 58: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Seven Bridges of Königsberg

• Cross each of seven bridges once and return back to starting point.

Eulerian Walk and Hamiltonian Cycles(Section 7.3 of textbook)

Page 59: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Seven Bridges of Königsberg

• Cross each of seven bridges once and return back to starting point.

• Let’s make graph of the problem. Replace LAND by NODESand BRIDGES by EDGES, connecting the lands.

Eulerian Walk and Hamiltonian Cycles(Section 7.3 of textbook)

Page 60: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Let’s Re-draw it: … and the Eulerian Trail

• Cross each of seven bridges once and return back to starting point.

• Eulerian Trail/Path: In a graph G, there is a closed path which traverse each edge ONLY ONCE and returns back to the starting point. ➔ such graph is called Eulerian Graph.

Eulerian Walk and Hamiltonian Cycles(Section 7.3 of textbook)

Page 61: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Eulerian Graph: A graph containing Eulerian Path

Eulerian Graph(Section 7.3 of textbook)

1

2 3

4

5

6

7

89

10

11

12

Page 62: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Eulerian Graph: A graph containing Eulerian Path

Eulerian Graph Semi-Eulerian Graph Non-Eulerian Graph

Eulerian Graph(Section 7.3 of textbook)

Page 63: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Which graph is an Eulerian Graph ?

Eulerian Graph Semi-Eulerian Graph Non-Eulerian Graph

Eulerian Graph(Section 7.3 of textbook)

Page 64: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Which graph is an Eulerian Graph ?

• Lemma: If in a graph G, every vertex has a degree at least 2, then G contains a cycle.

Eulerian Graph

Eulerian Graph(Section 7.3 of textbook)

Page 65: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Which graph is an Eulerian Graph ?

• Lemma: If in a graph G, every vertex has a degree at least 2, then G contains a cycle.

• Theorem (Euler, 1736): A connected graph G is Eulerian if and only if the degree of each vertex is even.• Proof: ☺

Eulerian Graph

Eulerian Graph(Section 7.3 of textbook)

Page 66: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Which graph is an Eulerian Graph ?

• Lemma: If in a graph G, every vertex has a degree at least 2, then G contains a cycle.

• Theorem (Euler, 1736): A connected graph G is Eulerian if and only if the degree of each vertex is even.• Proof: ☺

• Semi-Eulerian: if and only if it has exactly

two vertices of odd degree. Eulerian Graph

Eulerian Graph(Section 7.3 of textbook)

Page 67: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Theorem (Euler, 1736): A connected graph G is Eulerian if and only if the degree of each vertex is even.

• Proof: ☺

• How to construct: Fleury’s Algorithm:

Eulerian Graph

Eulerian Graph(Section 7.3 of textbook)

Page 68: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Eulerian Graph: Fleury’s Algorithm

• How to construct:

Eulerian Graph(Section 7.3 of textbook)

Page 69: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Eulerian Graph: Fleury’s Algorithm

• Try with these:

Eulerian Graph(Section 7.3 of textbook)

Page 70: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Eulerian Graph: Fleury’s Algorithm

• Try with these: Seven Bridges of Königsberg

Eulerian Graph(Section 7.3 of textbook)

Page 71: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Eulerian Graph: Fleury’s Algorithm

• Try with these: Seven Bridges of Königsberg

NOT SOLVABLE

Eulerian Graph(Section 7.3 of textbook)

Page 72: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Exercises

Eulerian Graph(Section 7.3 of textbook)

Page 73: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Exercises

Eulerian Graph(Section 7.3 of textbook)

Page 74: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Exercises

Eulerian Graph(Section 7.3 of textbook)

Page 75: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

• Hamiltonian Cycle: A cycle in a graph 𝐺 such that each NODE is visited ONLY ONCE.

Eulerian Walk and Hamiltonian Cycles(Section 7.3 of textbook)

Page 76: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Hamiltonian Graph

• Hamiltonian Cycle: In a graph G, there is a closed path which traverse each vertex ONLY ONCE and returns back to the starting point. ➔ such graph is called Hamiltonian Graph.

Page 77: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Hamiltonian Graph

• Hamiltonian Cycle: In a graph G, there is a closed path which traverse each vertex ONLY ONCE and returns back to the starting point. ➔ such graph is called Hamiltonian Graph.

Hamiltonian GraphSemi-Hamiltonian Graph

Non-Hamiltonian Graph

Page 78: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Hamiltonian Graph

• Which graphs are Hamiltonian?.

Page 79: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Hamiltonian Graph

• Which graphs are Hamiltonian?.

• Theorem (Dirac 1952):If G is a simple graph with n ≥3, and if deg(v) ≥ n/2 for each vertex v, then G is Hamiltonian.

Page 80: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Hamiltonian Graph

• Which graphs are Hamiltonian?.

• Theorem (Dirac 1952):If G is a simple graph with n ≥3, and if deg(v) ≥ n/2 for each vertex v, then G is Hamiltonian.

• Theorem (Ore 1960):If G is a simple graph with n ≥3, and if deg(v) + deg(w) ≥ n, for each pair of non-adjacent vertices v and w, then G is Hamiltonian.

Page 81: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Exercises

Page 82: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Exercises

Dodecahedron is Hamiltonian.

Page 83: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Exercises

Page 84: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Exercises

In a complete graph on 𝑛 nodes, 𝐾𝑛, how many Hamiltonian Cycles should be there?

e.g. 𝐾5Hamiltonian Cycles:

A-B-C-D-E-A

A-B-D-C-E-A

A-C-E-D-B-A

How many Hamiltonian Cycles: 4!

2𝑛− 1 !

2

Page 85: Graph Theory Basics · Let’s Re-draw it: … and the Eulerian Trail •Cross each of seven bridges once and return back to starting point. •Eulerian Trail/Path: In a graph G,

Practice ProblemsTry to solve at your own