Now that we've learnt about graphs and some graph traversal algorithms like breadth-first search and depth-first search, it's time to implement them. You can work in any programming language of your choice - Python, C++, Java, or anything else you want. Let's get started!
You are given an undirected graph with n nodes and m edges. The nodes are numbered from 0 to n-1. Find the shortest distance from the source (node 0) to all other nodes. If there is no path from the source to a particular node, output INF instead (for infinity).
Constraints: n \leq 10^5 and m \leq 10^6.