Graph example replicating graphs in Java version