Given an unweighted graph with n vertices and m edges represented as an adjacency list, implement breadth-first search (BFS) from a source vertex s to return:
(
-
an array dist where dist[v] is the length of the shortest path from s to v (or −1 if unreachable); and
(
-
an array parent to reconstruct one shortest path. Handle disconnected graphs, analyze time and space complexity, and provide code in C, C++, Java, or JavaScript.