0% found this document useful (0 votes)
4 views22 pages

Graphs and Digraphs

The document provides an overview of graphs and digraphs, including their definitions, terminologies, and various types. It explains key concepts such as vertices, edges, adjacency, and different graph types like complete, null, and simple graphs. Additionally, it discusses graph relationships and walks, trails, and paths within the context of graph theory.

Uploaded by

prabashanadinith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views22 pages

Graphs and Digraphs

The document provides an overview of graphs and digraphs, including their definitions, terminologies, and various types. It explains key concepts such as vertices, edges, adjacency, and different graph types like complete, null, and simple graphs. Additionally, it discusses graph relationships and walks, trails, and paths within the context of graph theory.

Uploaded by

prabashanadinith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

GRAPHS AND DIGRAPHS CHAPTER 09

GRAPHS (G)
e2 • Graphs can be used to model and analyze
e1 complex systems and relationships.

e3
• They are useful for visualizing and
understanding data.

• Graph algorithms are widely used in


computer science and other fields, such
as social network analysis, logistics, and
transportation.

A D
• Graphs can be used to represent a wide
range of data types, including social networks,
road networks, and the internet.

B C
GRAPHS TERMINOLOGIES Node / Vertex (V)
V(G)

Node / Vertex (V)


a1
A D
• "Vertex" is a synonym for a node of a
Edge (E)
graph. One of the points on which the a4
a2 E(G)
graph is defined and which may be
connected by graph edges
V(G) = {A,B,C,D} B a3 C

Edge (E) V(G) = {A,B,C,D}


• Each edge connects two different vertices.
E(G) = { {A,B} , {B,C} , {C,D} , {D,A} }
Edges are also called arcs and lines.
E(G) = { {A,B} , {B,C} , {C,D} , {D,A} }
GRAPHS TERMINOLOGIES
Incident Relationship
Node / Vertex (V)
V(G)
• Two edges are “incident” if they share a
common vertex.
Ex : a1 and a2 are incident because they
are share a common vertex D a1
A D
• Two vertices are “incident” if they share a Edge (E)
a4 E(G)
common edge. a2
Ex : A and B are incident because they are
share a common edge a4 B C
a3

• A vertex is incident with an edge if the


vertex is one of the endpoints of that edge
Ex : D and a2 are incident because they are
connected.
GRAPHS TERMINOLOGIES
Node / Vertex (V)
V(G)

Adjacent Relationship
a1
A D
• If two vertices in a graph are connected by
Edge (E)
an edge, we say the vertices are adjacent. a4 E(G)
a2
Ex : A adjacent to B and D
B a3 C
GRAPHS TERMINOLOGIES

Node / Vertex (V)


V(G)
R
Isolated Isolated

• If a vertex doesn't have any edges it is a1


A D
called an isolated vertex
Ex : R Edge (E)
a4 E(G)
a2

B a3 C
GRAPHS TERMINOLOGIES
Node / Vertex (V)
V(G)

End Vertices / Terminal Vertices


a1
• All the connected vertices for an edge. A D
Ex : for a2 D and C Edge (E)
a4 E(G)
a2

B a3 C
GRAPHS TERMINOLOGIES Node / Vertex (V)
V(G)
a5

Loop
a1
A D
Loop
Edge (E)
a4 E(G)
• In graph theory, a loop (also called a self- a2
loop or a buckle) is an edge that connects a
vertex to itself. A simple graph contains no B a3 C
loops.
Ex : a5
a5 = {A, A}
GRAPHS TERMINOLOGIES Node / Vertex (V)
V(G)

a1
A D
Edge (E)
Parallel Edges a4 E(G)
a2

• In graph theory, multiple edges (also called


B a3 C
parallel edges or a multi-edge) are in a
graph, two or more edges that are incident
to the same two vertices
a6
Ex : a6 Parallel Edge
a3 = {B, C}
a6 = {B, C}

∴ Parallel Edges = a3 and a6


GRAPHS TERMINOLOGIES Node / Vertex (V)
V(G)

a1
A D
Edge (E)
Order of a Graph a4 E(G)
a2
(Cardinality of a Graph)
B a3 C E
number of vertices in the graph.

a6

V(G) = {A, B, C, D, E}

∴ |V| = 5
GRAPHS TERMINOLOGIES Node / Vertex (V)
V(G)

F
a5
a1 a7
A D
Edge (E)
Size of a Graph a4 E(G)
a2
number of edges in the graph.
E
B a3 C

a6

E(G) = { {A,B}, {B,C}, {B,C}, {C,D}, {D,A}, {A,A}, {D,F} }

∴ |E| = 7
GRAPHS TERMINOLOGIES Node / Vertex (V)
V(G)

F
a5
a1 a7
A D
Edge (E)
Degree of a vertex (δ) a4 E(G)
a2
number of edges connected to a particular
E
vertex.
B a3 C
Deg(A)
δ (A)
A (Deg) a6

δ (D) = Deg (D) = D (Deg) = 1 + 1 + 1 = 3


δ (C) = Deg (C) = C (Deg) = 1 + 1 + 1 = 3
δ (A) = Deg (A) = A (Deg) = 1 + 1 + 2 = 4
Δ / δ = Delta
δ (E) = Deg (E) = E (Deg) = 0
GRAPH TYPES
F F
a5 a5
a7 a7
a1 a1
A D A D

a4 a4
a2 a2
E E
B a3 C B a3 C

Undirected Graph Directed Graph (Digraph)


a4 → a4( A, B )
a4 → a4(A,B) OR a4(B,A) a4 → a4(A,B) Only
∴ a4(A,B) = a4(B,A) ∴ a4(A,B) = a4(B,A) Tail Head

a7 → a7(D,F) OR a7(F, D) a7 → a7(D,F) Only


∴ a7(D,F) = a7(F, D) ∴ a7(D,F) = a7(F, D)
GRAPH TYPES

a1
A D

a4
a2

B a3 C Complete Graph
A complete graph is a graph that
has an edge between every single
vertex in the graph

No of vertices = n
Degree of one vertex = n-1
No of Edges = n(n-1) / 2
GRAPH TYPES

A D
D

C
B

Null Graph Trivial Graph


No edges found. A graph is said to be trivial if a finite graph contains
only one vertex and no edge. A trivial graph is a
graph with only one vertex and no edges. It is also
known as a singleton graph or a single vertex graph.
GRAPH TYPES
F
a7
a1
A D

A D a4
a2

B a3 C
C
B

Simple Graph Multi Graph


A simple graph is a graph that Any graph which contains some parallel edges but
does not contain more than one doesn’t contain any self-loop is called a multigraph.
edge between the pair of vertices.
(No Parallel edges)
GRAPH TYPES
F
a5 a1
a1 a7 A D
A D a7
a4
a2
a4 E F
a2
B a3 C
B a3 C

Connected Graph a6 Disconnected Graph


Graph is said to be connected if any pair of vertices Graph is said to be disconnected if any pair of
of a graph is reachable from one another. Or a graph vertices of a graph can not reachable from one
is said to be connected if there exists at least one path another.
between each and every pair of vertices in graph.
The walk will be known as the
GRAPH WALK Trivial walk if length of the walk = 0

F
F
a5
a1 a7
Length : No of edges a7
A D
D

a4
a2
a2

B a3 C
B a3 C

6 a
Closed Walk For Digraph need to
Open Walk
C→ C consider the direction
B→F C a3 B a4 A a1 D a2 C
B a3 C a2 D a7 F Length : 4
Length : 3 C a3 B a4 A a5 A a1 D a7 F a7 D a2 C
Length : 7
Can not mention same edge
GRAPH TRAIL again and again. But vertex can

F
F
a5
a1 a7
a7
A D
D

a4
a2
a2

B a3 C
B a3 C a6

Open Trail Closed Trail / Circuit


B→F C→ C For Digraph need to
B a3 C a2 D a7 F C a3 B a4 A a5 A a1 D a2 C consider the direction
Length : 5
Length : 3
C a3 B a4 A a5 A a1 D a7 F a7 D a2 C
Can not mention same edge or vertex
GRAPH PATH again and again.

F
F
a5
a1 a7
a7
A D
D

a4
a2
a2

B a3 C
B a3 C a6

Open Path Closed Path / Cycle


For Digraph need to
B→F C→ C consider the direction
B a3 C a2 D a7 F C a3 B a4 A a5 A a1 D a2 C
C a3 B a4 A a5 A a1 D a7 F a7 D a2 C

C a3 B a4 A a1 D a2 C
(Path start and end can be same)
GRAPH PATH
F
F
a5
a1 a7
a7
A D
D
G
a4 a8 a2
a2
a9
B a3 C
a3 C B
a6
Open Path Closed Path / Cycle
For Digraph need to
B→F C→ C consider the direction
B a3 C a2 D a7 F C a3 B a4 A a5 A a1 D a2 C
C a3 B a4 A a5 A a1 D a7 F a7 D a2 C

C a3 B a4 A a1 D a2 C
(Path start and end can be same)
END

You might also like