BFS: Shortest Reach, when the weights are same
BFS: Shortest Reach, when the weights are same

Consider an undirected graph consisting of  nodes where each node is labeled from  to  and the edge between any two
nodes is always of length . We define node  to be the starting position for a BFS.

Given  queries in the form of a graph and some starting node, , perform each query by calculating the shortest distance
from starting node  to all the other nodes in the graph. Then print a single line of  space-separated integers listing
node 's shortest distance to each of the  other nodes (ordered sequentially by node number); if  is disconnected from a
node, print  as the distance to that node.

rezaur86/Coding-competitions,rezaur86/Coding-competitions