- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Adjacency Matrices and their properties

## Adjacency Matrix

Adjacency Matrix is used to represent a graph. We can represent directed as well as undirected graphs using adjacency matrices. Following are the key properties of an Adjacency matrix.

## Properties

An Adjacency Matrix A[V][V] is a 2D array of size V × V where V is the number of vertices in a undirected graph.

If there is an edge between V

_{x}to V_{y}then the value of A[V_{x}][V_{y}] = 1 and A[V_{y}][V_{x}]=1, otherwise the value will be zero.For a directed graph, if there is an edge between V

_{x}to V_{y}, then the value of A[V_{x}][V_{y}]=1, otherwise the value will be zero.

**Adjacency Matrix of an Undirected Graph**

Let us consider the following undirected graph and construct the adjacency matrix −

Adjacency matrix of the above undirected graph will be −

a | b | c | d | |

a | 0 | 1 | 1 | 0 |

b | 1 | 0 | 1 | 0 |

c | 1 | 1 | 0 | 1 |

d | 0 | 0 | 1 | 0 |

**Adjacency Matrix of a Directed Graph**

Let us consider the following directed graph and construct its adjacency matrix −

Adjacency matrix of the above directed graph will be −

a | b | c | d | |

a | 0 | 1 | 1 | 0 |

b | 0 | 0 | 1 | 0 |

c | 0 | 0 | 0 | 1 |

d | 0 | 0 | 0 | 0 |

- Related Questions & Answers
- Planar Graphs and their Properties
- Pendent Vertex, Isolated Vertex and Adjacency of a graph
- Adjacency lists in Data Structures
- Is their JavaScript “not in” operator for checking object properties?
- Electromagnets and Their Uses
- C++ Program to Implement Adjacency List
- C++ Program to Implement Adjacency Matrix
- Digital Circuits and Their Applications
- Electrical Components and Their Symbols
- Internet Cookies and Their Types
- Definition and Properties of Trees
- PHP Static Properties and Methods
- Autocorrelation Function and its Properties
- Dijkstra’s Algorithm for Adjacency List Representation
- Prim’s MST for Adjacency List Representation