Add a graph represented as an adjacency list.