The node which is present farthest from the root node is taken as v If u is farther from root node then swap the two
if ( level [ u ] > level [ v ] ) { [ u , v ] = [ v , u ] } var d = level [ v ] - level [ u ] ;