14 Basic Graphs

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 88

Basic

Graphs
Outline

Paths, Cycles and Complete


Graphs

Trees

Bipartite Graphs
Path
Graphs
The Path Graph Pn, n ≥ 2, consists of
n vertices v1 , . . . , vn and n − 1 edges
{v1 , v2 }, . . . , {vn− 1 , vn }

v1 v2 ... v n−1 vn
Path
Graphs
The Path Graph Pn, n ≥ 2, consists of
n vertices v1 , . . . , vn and n − 1 edges
{v1 , v2 }, . . . , {vn− 1 , vn }

The Graph P5

v1 v2 v3 v4 v5
Path
Graphs
The Path Graph Pn, n ≥ 2, consists of
n vertices v1 , . . . , vn and n − 1 edges
{v1 , v2 }, . . . , {vn− 1 , vn }

The Graph P2

v1 v2
Path
Graphs
The Path Graph Pn, n ≥ 2, consists of
n vertices v1 , . . . , vn and n − 1 edges
{v1 , v2 }, . . . , {vn− 1 , vn }

The Graph P9

v1 v2 v3 v4 v5 v6 v7 v8 v9
Path
Graphs
The Path Graph Pn, n ≥ 2, consists of
n vertices v1 , . . . , vn and n − 1 edges
{v1 , v2 }, . . . , {vn− 1 , vn }

The Graph P9
v7
v9 v8
v6
v1
v5
v2
v3 v4
Cycle
Graphs
The Cycle Graph Cn, n ≥ 3,
consists of n vertices v1 , . . . , vn and
n edges
{v1 , v2 }, . . . , {vn− 1 , vn }, {vn , v1 }

v1 v2 ... v n−1 vn
Cycle
Graphs
The Cycle Graph Cn, n ≥ 3,
consists of n vertices v1 , . . . , vn and
n edges
{v1 , v2 }, . . . , {vn− 1 , vn }, {vn , v1 }

The Graph C5
v1 v2 v3 v5
v4
Cycle
Graphs
The Cycle Graph Cn, n ≥ 3,
consists of n vertices v1 , . . . , vn and
n edges
{v1 , v2 }, . . . , {vn− 1 , vn }, {vn , v1 }

The Graph C5

v5
v4
v1
v3
v2
Cycle
Graphs
The Cycle Graph Cn, n ≥ 3,
consists of n vertices v1 , . . . , vn and
n edges
{v1 , v2 }, . . . , {vn− 1 , vn }, {vn , v1 }

The Graph C3

v1 v2

v3
Cycle
Graphs
The Cycle Graph Cn, n ≥ 3, consists
of n vertices v1 , . . . , vn and n edges
{v1 , v2 }, . . . , {vn− 1 , vn }, {vn , v1 }

The Graph C9
v8 v7
v9
v6
v1
v5
v2
v3 v4
Complete Graphs

The Complete Graph (Clique) Kn, n ≥


2, contains n vertices v1 , . . . , vn and
all edges between them (n(n − 1)/2
edges)

v6 v5

v1 v4

v2 v3
Complete Graphs

The Complete Graph (Clique) Kn, n ≥


2, contains n vertices v1 , . . . , vn and
all edges between them (n(n − 1)/2
edges)
The Graph K6

v6 v5

v1 v4

v2 v3
Complete Graphs

The Complete Graph (Clique) Kn, n ≥


2, contains n vertices v1 , . . . , vn and
all edges between them (n(n − 1)/2
edges)
The Graph K5

v5
v4
v1
v3
v2
Complete Graphs

The Complete Graph (Clique) Kn, n ≥


2, contains n vertices v1 , . . . , vn and
all edges between them (n(n − 1)/2
edges)
The Graph K3

v1 v2

v3
Complete Graphs

The Complete Graph (Clique) Kn, n ≥


2, contains n vertices v1 , . . . , vn and
all edges between them (n(n − 1)/2
edges)
The Graph K3 = C3
v1 v2

v3
Complete Graphs

The Complete Graph (Clique) Kn, n ≥


2, contains n vertices v1 , . . . , vn and
all edges between them (n(n − 1)/2
edges)
The Graph K2

v1 v2
Complete Graphs

The Complete Graph (Clique) Kn, n ≥


2, contains n vertices v1 , . . . , vn and
all edges between them (n(n − 1)/2
edges)
The Graph K2 = P2
v1 v2
Outline

Paths, Cycles and Complete


Graphs

Trees

Bipartite Graphs
Trees

v6

v4 v5

v1

v3 v2
Trees

v6

v4 v5

v1

v3 v2
Trees

v6

v4 v5

v1

v3 v2
Trees

v6

v4 v5

v1

v3 v2
Trees

v6

v4 v5

v1

v3 v2
Trees

v6

v4 v5

v1

v3 v2
Trees

v6

v4 v5

v1

v3 v2
Trees

v6

v4 v5

v1

v3 v2
Trees

v6

v4 v5

v1

v3 v2
Definition

• A tree is a connected graph without


cycles
Definition

• A tree is a connected graph without cycles

• A tree is a connected graph on n vertices


with
n − 1 edges
Definition

• A tree is a connected graph without cycles

• A tree is a connected graph on n vertices with


n − 1 edges

• A graph is a tree if and only if there is a


unique simple path between any pair of its
vertices
Trees: Examples
Trees: Examples
Trees: Examples
Trees: Examples

v1 v2 v3 v4 v5
Trees: Examples

v1 v2 v3 v4 v5
Trees: Examples
v5

v4

v3
Drawing a Tree

v5 v6

v4 v10

v3 v9

v1 v2 v7 v8
Drawing a Tree

v5 v6

v4 v10

Root
v3 v9

v1 v2 v7 v8
Drawing a Tree

v5 v6

v4 v10

v3 v9

v1 v2 v7 v8
Drawing a Tree

v5 v6

v3
v4 v10

v3 v9

v1 v2 v7 v8
Drawing a Tree

v5 v6

v3
v4 v10
v4 v1 v2 v9

v3 v9

v1 v2 v7 v8
Drawing a Tree

v5 v6

v3
v4 v10
v4 v1 v2 v9

v3 v9

v5 v6

v1 v2 v7 v8
Drawing a Tree

v5 v6

v3
v4 v10
v4 v1 v2 v9

v3 v9

v5 v6 v7 v8 v
10

v1 v2 v7 v8
Drawing a Tree

v3

v4 v1 v2 v9

v5 v6 v7 v8 v10
Drawing a Tree

Connected; the number of edges is n − 1


v3

v4 v1 v2 v9

v5 v6 v7 v8 v10
Make a Tree

v5
v
4

v1

v
3
Make a Tree

Remove any edge, keeping the


graph connected

v5
v
4

v1

v
3
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Make a Tree

Remove any edge, keeping the


graph connected
Stop when only n − 1 edges
left

v5
v4

v1

v3
v2
Outline

Paths, Cycles and Complete


Graphs

Trees

Bipartite Graphs
Bipartite Graphs

• A graph G is Bipartite if its vertices can be


partitioned into two disjoint sets L and R
such that
Bipartite Graphs

• A graph G is Bipartite if its vertices can be


partitioned into two disjoint sets L and R
such that
• Every edge of G connects a vertex in L
t o a vertex in R
Bipartite Graphs

• A graph G is Bipartite if its vertices can be


partitioned into two disjoint sets L and R
such that
• Every edge of G connects a vertex in L
t o a vertex in R
• I.e., no edge connects two vertices
from the same part
Bipartite Graphs

• A graph G is Bipartite if its vertices can be


partitioned into two disjoint sets L and R
such that
• Every edge of G connects a vertex in L
t o a vertex in R
• I.e., no edge connects two vertices
from the same part
• L and R are called the parts of G
Bipartite Graphs: Examples
Bipartite Graphs: Examples
Bipartite Graphs: Examples
Bipartite Graphs: Examples

v3

v2 v6

v1 v5 v9

v4 v8

v7
Bipartite Graphs: Examples

v3

v2 v6

v1 v5 v9

v4 v8

v7
Bipartite Graphs: Examples

v3

v2 v6

v1 v5 v9

v4 v8

v7
Bipartite Graphs: Examples

v3

v2 v6

v1 v5 v9

v4 v8

v7
Bipartite Graphs: Examples

v3

v2 v6

v1 v5 v9

v4 v8

v7
Bipartite Graphs: Examples

v3

v9 v8
v2 v6
v6
v7
v1 v5 v9 v4
v5
v4 v8
v3
v2
v7

v
Bipartite Graphs: Examples

v3

v9 v8
v2 v6
v6
v7
v1 v5 v9 v4
v5
v4 v8
v3
v2
v7

v
Complete Bipartite
Graphs
Complete Bipartite
Graphs

Complete bipartite graph


Complete Bipartite Graphs

Complete bipartite graph K2,3


Complete Bipartite
Graphs
Complete Bipartite Graphs

Complete bipartite graph K4,3


Cycle Graphs

For even n, Cn is bipartite


Cycle Graphs

For odd n > 2, Cn is not bipartite


Trees are bipartite
Trees are bipartite
Trees are bipartite
Trees are bipartite
Trees are bipartite

You might also like