Challenge: Converting Graph Representations

Practice converting adjacency matrices to adjacency lists and vice versa.

In the previous lessons, we have studied the two graph representations: adjacency matrix and adjacency list. Both are equally expressive and can be converted into the other.

Here is a function that converts an adjacency matrix into an adjacency list in the naive implementation:

Get hands-on with 1200+ tech skills courses.