Introduction to Graph Data Structure:

A graph consists of a set of vertices and a set of edges. The two main ways of representing graphs are adjacency matrix representation and adjacency list representation.

In adjacency matrix representation of a Graph with n vertices and e edges, a two dimensional nxn array , say a , is used , with the property that a[i,j] equals 1 if there is an edge from i to j and a[i,j] equals 0 if there is no edge from i to j.




In adjacency list representation of a graph with n vertices and e edges, there are n linked lists, one list for each vertex in the graph.

The usual operations on the graph are:

1. Indegree(i) – returns the indegree (the number of edges ending on) of the ith vertex
2. Outdegree(i) – returns the outdegree(the number of edges moving out) of the ith vertex)
3. displayAdjMatrix – displays the adjacency matrix for the graph 


Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments:

Thanks
Mukesh Rajput