Convert a list of edges to an adjacency list