Matrix Representation of Graphs

In this post, you will learn how to represent a graph in matrix form. By using this concept we can easily create implementation of adjacency matrix.

If there is an edge between two vertices then we will represent it with 1 and if there is no edge then with 0.

Adjacency Matrix Representation of Graphs

For Undirected Graph:

Matrix Representation of Graphs
12345
101001
210100
301010
400101
510010

Directed Graphs:

Matrix Representation of Graphs
12345
100001
210000
301000
400100
500010

If You Like This Page Then Make Sure To Follow Us on Facebook, G News and Subscribe Our YouTube Channel. We will provide you updates daily.
Share on:

NK Coderz is a Computer Science Portal. Here We’re Proving DSA, Free Courses, Leetcode Solutions, Programming Languages, Latest Tech Updates, Blog Posting Etc.

Leave a Comment