For a given unweighted graph find the distance between source and destination. USING C++ PROGRAMMING LANGUAGE.

If we consider a source vertex in a graph then we can calculate the distance of every vertex from the source vertex of the graph. The distance which will be given between source and destination is the shortest distance which we calculated using the binary first search algorithm in the graph. Eg. Vertex of graph:-

1-2 2-3 3-0 3-4 4-5 and if the source is 0, then the distance of vertex 0 from source is 0.

then the distance of vertex 1 from the source is 1.

then the distance of vertex 3 from the source is 1.

then the distance of vertex 2 from the source is 2.

then the distance of vertex 4 from the source is 3.

then the distance of vertex 5 from the source is 4.

Submitted by Madhavendra Krishana Gupta (Madhavendra)

Download packets of source code on Coders Packet