Union of all edges incident on vertex with maximum degree
for ( let v = 0 ; v < g [ max ] . length ; v ++ ) { document . write ( max + " " + g [ max ] [ v ] + " " ) ; union ( max , g [ max ] [ v ] ) ; }