to store first vertex , second vertex and weight of the edge
static class Edge implements Comparable < Edge > { int first , second , weight ; Edge ( int x , int y , int w ) { this . first = x ; s this . second = y ; this . weight = w ; } @ Override public int compareTo ( Edge edge ) { return this . weight - edge . weight ; } } static int mod = 1000000007 ;