map graph representation could be done. neighbors lists now contains null elements for non-existing neighbors (dead space). null is added to maintain ordering
refactors some graph code, moving boilerplate into separate functions