Bfs : shoretest path

In the function bfs( ),
One why we made the map< T , T > parent.
Is it necessary ??

hey @AnonymousReta
storing parents is necessary when you have to print the shortest path ,
if you do not have to print the path, just wanted to print the distance then you can ignore it.

Got it!!
Thanku so much:blush::blush::blush:

1 Like