def normalized_cut_size(G, S, T=None, weight=None):
 if (T is None):
  T = (set(G) - set(S))
 num_cut_edges = cut_size(G, S, T=T, weight=weight)
 volume_S = volume(G, S, weight=weight)
 volume_T = volume(G, T, weight=weight)
 return (num_cut_edges * ((1 / volume_S) + (1 / volume_T)))

def normalized_cut_size ( G , S , T = None , weight = None ) : if ( T is None ) : T = ( set ( G ) - set ( S ) ) num_cut_edges = cut_size ( G , S , T = T , weight = weight ) volume_S = volume ( G , S , weight = weight ) volume_T = volume ( G , T , weight = weight ) return ( num_cut_edges * ( ( 1 / volume_S ) + ( 1 / volume_T ) ) )
returns the normalized size of the cut between two sets of nodes .