20
Graphs Fariha Tasmin Jaigirdar Assistant Professor Daffodil International University

Graphs

Embed Size (px)

Citation preview

Page 1: Graphs

GraphsFariha Tasmin JaigirdarAssistant ProfessorDaffodil International University

Page 2: Graphs

Graphs

Page 3: Graphs

Graphs

Page 4: Graphs

Directed Graph

Page 5: Graphs

Directed Graph Cont.

Page 6: Graphs

Directed Graph Cont.

Page 7: Graphs

Undirected Graph

Page 8: Graphs

Undirected Graph cont.

Page 9: Graphs

Sub-graph

Page 10: Graphs

Weighted Graph

Page 11: Graphs

Weighted Graph cont.

Page 12: Graphs

Complete/Strongly/Fully Connected Graph

Page 13: Graphs

REPRESENTATION OF GRAPH

Graph is a mathematical structure and finds its application is many areas, where the problem is to be solved by computers. The problems related to graph G must be represented in computer memory using any suitable data structure to solve the same. There are two standard ways of maintaining a graph G in the memory of a computer.

1. Sequential representation of a graph using adjacent 2. Linked representation of a graph using linked list

Page 14: Graphs

ADJACENCY MATRIX REPRESENTATION Directed Graph

Let us see how a directed graph can be represented using adjacency matrix. The A of a graph G = (V, E) with n vertices, is an n x n matrix. Considered a directed graph in Fig. 9.12 where all the vertices are numbered, (1, 2, 3, 4...... etc.)

Page 15: Graphs

ADJACENCY MATRIX REPRESENTATION Directed Graph cont.The adjacency matrix A of a directed graph G = (V, E) can be represented (in Fig 9.13) with the following conditions

Page 16: Graphs

ADJACENCY MATRIX REPRESENTATION Undirected GraphWe have seen how a directed graph can be represented in adjacency matrix. Now let us discuss how an undirected graph can be represented using adjacency matrix. The adjacency matrix A of an undirected graph G = (V, E) can be represented (in Fig 9.15) with the following conditions

Page 17: Graphs

ADJACENCY MATRIX REPRESENTATION Weighted Graph

Page 18: Graphs

ADJACENCY MATRIX REPRESENTATION Weighted Graph cont.

Page 19: Graphs

LINKED LIST REPRESENTATIONDirected Graph

Page 20: Graphs

LINKED LIST REPRESENTATIONDirected Graph