Fixed a bug in the creation of the adjacency list