Discuss different representations of a graph.
Representation of Graph
- A diagrammatic representation of a graph may have limited usefulness. However such a representation is not feasible when number of nodes an edges in a graph is large.
- Hence the graph can be represented in another two ways.
- Matrix representation of Graph
- Linked List representation of Graph
Matrix Representation of Graph (Adjacency matrix)
- The number of elements in the i_{th} row whose value is 1 is equal to the out-degree of node V_{i}.
- The number of elements in the j_{th} column whose value is 1 is equal to the in-degree of node V_{j}.
- For a NULL graph which consist of only n nodes but no edges, the adjacency matrix has all its elements 0. i.e. the adjacency matrix is the NULL matrix.
Linked List representation of Graph (Adjacency List Representation)