Learning exercise to implement graph data structures