https://cp-algorithms.com/graph/breadth-first-search.html

Can anyone please explain in the code in above page-what the arrays d[n],p[n] does,what are they storing???

https://cp-algorithms.com/graph/breadth-first-search.html

Can anyone please explain in the code in above page-what the arrays d[n],p[n] does,what are they storing???

d[n] stores the distance of the node n from the source vertex. p[n] stores the parent of a given node n.

p[n] is an array which is storing the parent of a vertex i.e from which last vertex we reached this vertex

d[n] is an array which is storing the distance of a particular vertex from a source vertex(which is basically the distance of its parent vertex from the source+1)