How to represent a graph in data structure through Adjacency matrix | Data Structure Problems

In our programming website we teach computer coding to kids and pros for free online in easy way and gives knowledge  about Data structure and alogorithm in C,Java,Python and other programming languages that may help you land an  online job and make your programmers day successfull.We use best data structure notes and best programming resources.

Graph is an important part of data structure & algothims,if you keen to learn coding you can't miss graph in data structure,in this article I try to keep the explanation as simple as possible.You know learn programming in coding classes is just boarning.If you want cool stuff you must practice problems.Learn coding through ppractice is the best way.Here also I tell you about graph by examples.
But at first  I want to give you a brief intro about our blog;
In our programming website we teach computer coding to kids and pros for free online in easy way and gives knowledge about Data structure and alogorithm in C,Java,Python and other programming languages that may help you land an online job and make your programmers day successfull.We use best data structure notes and best programming resources.
Here goes the article,thanks for having patience & don't forget to share with your friends 👌
Graph is an important part of data structure,it is a collection of some nodes called vertices and some lines called edges.
Graphs are mainly of two types,
i)undirected graph & ii)directed graph.
undirected graph or simple graph is a graph without any direction & directed graph is a graph  which have directions,the directions are basically represented by arrows.
But a computer couldn't unnderstand those pictorial representation with nodes,edges,arrows right? So we have to find a way to represent them in way that can be understood by the computer also.
There are two ways to represent a graph they are i)Adjacency Matrix and ii)Adjacency list.
In this article we will talk about Adjacency Matrix only.
Adjacency matrix is a square Matrix  used to represent a graph.It consists 0's and 1's. 0 represent no age present between pair of vertices and 1 represent an edge present between pair of vertices.
Lets us take some examples so that you can understand them clearly.Don't worry it will be easy after understanding them you will also enjoy them,trust me. ☺
Here goes the examples:
In our programming website we teach computer coding to kids and pros for free online in easy way and gives knowledge  about Data structure and alogorithm in C,Java,Python and other programming languages that may help you land an  online job and make your programmers day successfull.We use best data structure notes and best programming resources.
Adjacency Matrix for a undirected Graph

In our programming website we teach computer coding to kids and pros for free online in easy way and gives knowledge  about Data structure and alogorithm in C,Java,Python and other programming languages that may help you land an  online job and make your programmers day successfull.We use best data structure notes and best programming resources. Here goes the article,dont forget to share with your friends ??
Adjacency matrix for an directed Graph
Hope this wil help you.In the next article I will  tell you about Adjacency List,so stay tuned & please share this article with your  friends,I really need your support.

Post a Comment

0 Comments