kruskals algorithm working, proper output established