Representation of Graph
Representation of Graph
✓ Adjacency list
Adjacency Matrix
✓ A sequential representation is an adjacency
matrix.
✓ It shows which nodes are next to one another.
✓ Create M x M matrix.
✓ If an edge exists between vertex a and b, the
corresponding element of G, G = 1, otherwise 0.
✓ If there is a weighted graph, and record the edge's
weight instead of 1s and 0s.
Adjacency Matrix -Directed Graph Representation
Adjacency Matrix -Undirected Graph Representation
Adjacency Matrix -
Weighted Directed Graph Representation
✓ Weight or cost is indicated at the graph's edge,
✓ a weighted graph representing these values in the
matrix.
Adjacency Matrix -
Weighted UnDirected Graph Representation
✓ Weight or cost is indicated at the graph's edge,
✓ a weighted graph representing these values in the
matrix.
Adjacency List-
Weighted Directed Graph Representation
✓ An adjacency list is used in the linked
representation to store the Graph in the
computer's memory.
✓ It is maintained for each node present in the graph,
which stores the node value and a pointer to the
next adjacent node.
✓ If all the adjacent nodes are traversed, then store
the NULL in the pointer field of the last node of the
list.
Adjacency List-
Directed Graph Representation
✓ Creating graphs
✓ Insert vertex
✓ Delete vertex
✓ Insert edge
✓ Delete edge
Creating Graphs
There are two techniques to make a graph: