input, graph setup, bfs