Adjacency list class for graph problems