Based on Kruskals Algorithm

I am trying to debug my code but unable to find my error . Please find it.
This is the link to my code :


The doubt got resolved …I was just missing to add comparator in my sorting function .Thank you.