# 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.

## Adjacency Matrix

- 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 v_{j}represents vertices. - a
_{ij }is**1**if v_{ i }and v_{j}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.

### Adjacency List

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.

### Advantages of Adjacency List

- It clearly shows the adjacent nodes of a particular node.
- Adding new nodes in the list is easy as compared to adding nodes in the adjacency matrix.

## Comments

So empty here ... leave a comment!