fix bugs in adjacency list generation; add tests