BFS -Shortest Path

Getting run time error in test case 1, for problem named bfs -shortest path in graph practice section

actually you are taking new int v[n], but you should take new int v[n+1] , because you want to use the lastt array index , as nodes are 1 based indexed