Adjacency List PHP class