Graph problem fixed and working on the contraction algorithm