If we are taking weight as a third component in a vector of edges and we want to sort it with the help of custom comparator,how can we do it?

Ljink:https://ide.codingblocks.com/s/342157
I wrote a partial code but getting error on use of custom comparator.Please correct only this much code and tell me how to use custom comparator

hello @KetanPandey

u r getting this error,
to remove this simply make ur comparator as static function and then it should work.

btw ur comparator logic is correct

Yes its working now.But please explain what has happened by makingthe function static.I have not read any such concept so far to make comparator function static.Please explain logic behind it

@KetanPandey
refer this->thread

Yes its working now.But please explain what has happened by makingthe function static.I have not read any such concept so far to make comparator function static.Please explain logic behind it.I didi not understood this

pls check my previous reply , i have shared the relvant link