Changed bfs to take pathTable and pathSize as arguments