add generic queues
make bfs parameterized with visit fns and genqueue

- other refactorings like pulling adjlist fns into separate file