Simple graph implementation written in Java