# Representation of Graphs

Graphs can be represented by

• Adjacency Matrix by Sequential Representation
• Linked Representation by using an adjacency list that stores neighbors of a node using linked list.

• It represents which nodes are adjacent to each other i.e. which nodes have edge connecting between them.
• Rows and Columns are labeled by graph vertices.
• a is the adjacency matrix,i represents row, j represents column,v i and vj represents vertices.
• aij is 1 if  v i and vj are adjacent to each other and 0 if they are not.
• Adjacency Matrix is also known as Bit matrix or Boolean Matrix since it contains only o's and 1's.

### Undirected Graph

The graph is shown in Fig 1 and matrix is shown in Fig 2.

### Directed Graph

The graph is shown in Fig 3 and matrix is shown in Fig 4.

### Weighted Graph

The graph is shown in Fig 5 and matrix is shown in Fig 6.

It is an another way to represent graphs in computer memory.It is a linked representation in which every node is linked to its own list that contains he names of all other nodes which are adjacent to itself.The graph is shown in Fig 7 and list is shown in Fig 8.