• NEET
      • Class 11th
      • Class 12th
      • Class 12th Plus
    • JEE
      • Class 11th
      • Class 12th
      • Class 12th Plus
    • Class 6-10
      • Class 6th
      • Class 7th
      • Class 8th
      • Class 9th
      • Class 10th
    • View All Options
      • Online Courses
      • Offline Courses
      • Distance Learning
      • Hindi Medium Courses
      • International Olympiad
    • NEET
      • Class 11th
      • Class 12th
      • Class 12th Plus
    • JEE (Main+Advanced)
      • Class 11th
      • Class 12th
      • Class 12th Plus
    • JEE Main
      • Class 11th
      • Class 12th
      • Class 12th Plus
  • NEW
    • JEE MAIN 2025
    • NEET
      • 2024
      • 2023
      • 2022
    • Class 6-10
    • JEE Main
      • Previous Year Papers
      • Sample Papers
      • Result
      • Analysis
      • Syllabus
      • Exam Date
    • JEE Advanced
      • Previous Year Papers
      • Sample Papers
      • Mock Test
      • Result
      • Analysis
      • Syllabus
      • Exam Date
    • NEET
      • Previous Year Papers
      • Sample Papers
      • Mock Test
      • Result
      • Analysis
      • Syllabus
      • Exam Date
    • NCERT Solutions
      • Class 6
      • Class 7
      • Class 8
      • Class 9
      • Class 10
      • Class 11
      • Class 12
    • CBSE
      • Notes
      • Sample Papers
      • Question Papers
    • Olympiad
      • NSO
      • IMO
      • NMTC
    • ALLEN e-Store
    • AOSAT
    • ALLEN for Schools
    • About ALLEN
    • Blogs
    • News
    • Careers
    • Request a call back
    • Book home demo
JEE PhysicsJEE Chemistry
Home
JEE Maths
Adjacency Matrix

Adjacency Matrix

Let aij denote the number of edges (Vi, Vj) then A = [aij]m×m is called adjacency matrix of G if

aij​={10​ if (Vi​,Vj​) is an edges  otherwise ​

1.0Definition of Adjacency Matrix

In graph theory, an adjacency matrix is a square matrix that represents a finite graph. The elements of this matrix indicate whether pairs of vertices in the graph are connected by an edge. For a graph with n vertices, the adjacency matrix is an n × n matrix where the element Aij is:

  • 1 if an edge exists between vertex i and vertex j;
  • 0 if no edge exists between vertex i and vertex j.

This matrix representation provides a powerful tool for analyzing and manipulating graph structures, making it essential for studying various types of graphs, including undirected and directed graphs.

2.0Adjacency Matrix for Undirected Graphs

In an undirected graph, the edges are not directional, meaning the edge between two vertices is bidirectional. Consequently, the adjacency matrix for an undirected graph is symmetric. If there is an edge between vertices i and j, then both Aij and Aji will be 1.

Example: 

Consider an undirected graph with 4 vertices V = {A, B, C, D} and the following edges:

Adjacency Matrix for undirected graph

The adjacency matrix for this graph is:

V=​0110​1001​1000​0100​​

Here, the matrix is symmetric about the diagonal, indicating the undirected nature of the graph.

3.0Adjacency Matrix for Directed Graphs

In a directed graph, the edges have a specific direction, meaning they go from one vertex to another and not necessarily in both directions. The adjacency matrix of a directed graph does not need to be symmetric.

Example: 

Consider a directed graph with 4 vertices V = {A, B, C, D} and the following directed edges:

Adjacency Matrix for directed graphs

The adjacency matrix for this graph is:

V=​0000​1000​1000​0100​​

This matrix is not symmetric, which reflects the directed nature of the graph.

4.0Properties of Adjacency Matrices

  1. Symmetry: The adjacency matrix of an undirected graph is always symmetric.
  2. Diagonal Elements: In a simple graph, the diagonal elements of the adjacency matrix are 0, as there are no self-loops (no vertex is connected to itself)
  3. Sparsity: For large graphs, adjacency matrices are typically sparse, meaning most elements are 0, as the number of edges is usually much smaller than the number of possible connections.
  4. Degree of Vertices: For an undirected graph, the degree of a vertex can be calculated by summing the values in its corresponding row (or column, due to symmetry). For directed graphs, the out-degree is the sum of the row, and the in-degree is the sum of the column.

5.0Solved Examples on Adjacency Matrix

Example 1: Consider the undirected graph G as shown below. Find the Adjacency matrix.

Example question on adjacency matrix

Solutions:

A=​01001​10100​01010​00101​10010​​

Example 2: Find the Adjacency matrix of graph G.

Adjacency matrix directed graph questions

Solutions:

A=​00000​10000​01000​00101​10000​​


Example 3: Consider the undirected graph G as shown below. Find the Adjacency matrix.

Adjacency matrix for undirected graph

Solutions:

G=​0011​0011​1101​1110​​


Example 4: Find the Adjacency matrix of the graph.

Example question of adjacency matrix directed graph

Solutions:

G=​00100​10000​01000​10100​00100​​ 


Example 5: Plot a graph given by the following adjacency matrixG=​0111​0011​1101​1110​​

Solutions:

Solution for adjacency matrix


Example 6: Write down the Adjacency matrix of graph G.

Sample practice question on adjacency matrix

Solutions:

G=​01101​10010​10000​01001​10010​​

6.0Practice Questions on Adjacency Matrix

  1. Construct the adjacency matrix for a directed graph with vertices V = {A, B, C, D}. 

Practice question on adjacency matrix

  1. Given the adjacency matrix below, determine whether the graph is directed or undirected:​0101​1010​0101​1010​​
  2. For a graph with vertices V = {P, Q, R, S} and the adjacency matrix:​0011​1001​1100​0110​​List all the edges of the graph and state whether it is directed or undirected.
  3. Construct the adjacency matrix for a directed graph with vertices V = {A, B, C, D, E}. 

Adjacency matrix's sample practice questions


Table of Contents


  • 1.0Definition of Adjacency Matrix
  • 2.0Adjacency Matrix for Undirected Graphs
  • 3.0Adjacency Matrix for Directed Graphs
  • 4.0Properties of Adjacency Matrices
  • 5.0Solved Examples on Adjacency Matrix
  • 6.0Practice Questions on Adjacency Matrix

Frequently Asked Questions

An adjacency matrix is a square matrix used to represent a graph. Each element indicates whether a pair of vertices is adjacent (connected by an edge) or not.

To construct an adjacency matrix, assign a 1 to the matrix element Aij if there's an edge between vertex i and vertex j; otherwise, assign a 0.

In an undirected graph, the adjacency matrix is symmetric, while in a directed graph, it is generally not symmetric, as it reflects the direction of edges.

Yes, an adjacency matrix can represent weighted graphs. Instead of using 1s and 0s, the matrix elements Aij are the weights of the edges. If there is an edge between vertices i and j; otherwise, assign a 0.

In a simple graph, diagonal elements are 0, indicating no self-loops. In other types of graphs, a non-zero diagonal element may represent a self-loop, where a vertex is connected to itself.

Adjacency matrices are commonly used in algorithms for graph traversal, finding the shortest path, detecting cycles, and more, due to their straightforward representation of vertex connections.

Join ALLEN!

(Session 2025 - 26)


Choose class
Choose your goal
Preferred Mode
Choose State
  • About
    • About us
    • Blog
    • News
    • MyExam EduBlogs
    • Privacy policy
    • Public notice
    • Careers
    • Dhoni Inspires NEET Aspirants
    • Dhoni Inspires JEE Aspirants
  • Help & Support
    • Refund policy
    • Transfer policy
    • Terms & Conditions
    • Contact us
  • Popular goals
    • NEET Coaching
    • JEE Coaching
    • 6th to 10th
  • Courses
    • Online Courses
    • Distance Learning
    • Online Test Series
    • International Olympiads Online Course
    • NEET Test Series
    • JEE Test Series
    • JEE Main Test Series
  • Centers
    • Kota
    • Bangalore
    • Indore
    • Delhi
    • More centres
  • Exam information
    • JEE Main
    • JEE Advanced
    • NEET UG
    • CBSE
    • NCERT Solutions
    • NEET Mock Test
    • Olympiad
    • NEET 2025 Answer Key

ALLEN Career Institute Pvt. Ltd. © All Rights Reserved.

ISO