this time the graphs are stored in lists of adjacency