Prim 's algorithm using priority_queue in STL | If v is not in MST and weight of ( u , v ) is smaller than current key of v ; Updating key of v
if ( inMST [ v ] == false && key [ v ] > weight ) { key [ v ] = weight ; pq . add ( new Pair < Integer , Integer > ( key [ v ] , v ) ) ; parent [ v ] = u ; }