def compute_key(gr, n, nodes_explored):
 min = float('inf')
 for v in gr.neighbors(n):
  if (v in nodes_explored):
   w = gr.get_edge_weight((n, v))
   if (w < min):
    min = w
 return min

def compute_key ( gr , n , nodes_explored ) : min = float ( 'inf' ) for v in gr . neighbors ( n ) : if ( v in nodes_explored ) : w = gr . get_edge_weight ( ( n , v ) ) if ( w < min ) : min = w return min
computes minimum key for node n from a set of nodes_explored in graph gr .