working on kruskals algorithm