Graph in java