The square of a directed graph G=(V,E) is the graph G2=(V,E2) such that
(u,v) ∈ E2 if and only G contains a path with at most two edges between u and v.
Describe efficient algorithms for computing G2 from G for both the adjacency-list
and adjacency-matrix representations of G. Analyze the running times of your
algorithms.