Adjacency Matrix for Directed and Unweighted graph

Consider an Directed and Unweighted graph with 4 vertices and 4 edges. For the graph G, the adjacency matrix would look like:

Here’s how to interpret the matrix:

  • A[0][1] ​= 1, there is an edge between vertex 0 and vertex 1.
  • A[1][2] ​= 1, there is an edge between vertex 1 and vertex 2.
  • A[2][3] = 1, there is an edge between vertex 2 and vertex 3.
  • A[3][1] = 1, there is an edge between vertex 3 and vertex 1.
  • A[i][i] = 0, as there are no self loops on the graph.
  • All other entries with a value of 0 indicate no edge between the corresponding vertices.

Adjacency Matrix of Directed Graph

Adjacency Matrix of a Directed Graph is a square matrix that represents the graph in a matrix form. In a directed graph, the edges have a direction associated with them, meaning the adjacency matrix will not necessarily be symmetric.

In a directed graph, the edges have a direction associated with them, meaning the adjacency matrix will not necessarily be symmetric. The adjacency matrix A of a directed graph is defined as follows:

Similar Reads

What is Adjacency matrix of Directed graph?

For a graph with N vertices, the adjacency matrix A is an N X N matrix where:...

Adjacency Matrix for Directed and Unweighted graph:

Consider an Directed and Unweighted graph G with 4 vertices and 4 edges. For the graph G, the adjacency matrix would look like:...

Adjacency Matrix for Directed and Weighted graph:

Consider an Directed and Weighted graph G with 5 vertices and 6 edges. For the graph G, the adjacency matrix would look like:...

Properties of Adjacency Matrix of Directed Graph:

Diagonal Entries: The diagonal entries Aii​ are usually set to 0, assuming the graph has no self-loops.Out-degree and In-degree: The number of 1’s in a row i (out-degree) indicates the number of outgoing edges from vertex i, while the number of 1’s in a column j (in-degree) indicates the number of incoming edges to vertex j....

Implementation of Adjacency Matrix of Directed Graph:

Below is the implementation of Adjacency Matrix of Directed Graph in different languages:...