Graph rep in java