def ncut_cost(cut, D, W):
 cut = np.array(cut)
 cut_cost = _ncut_cy.cut_cost(cut, W)
 assoc_a = D.data[cut].sum()
 assoc_b = D.data[(~ cut)].sum()
 return ((cut_cost / assoc_a) + (cut_cost / assoc_b))

def ncut_cost ( cut , D , W ) : cut = np . array ( cut ) cut_cost = _ncut_cy . cut_cost ( cut , W ) assoc_a = D . data [ cut ] . sum ( ) assoc_b = D . data [ ( ~ cut ) ] . sum ( ) return ( ( cut_cost / assoc_a ) + ( cut_cost / assoc_b ) )
returns the n-cut cost of a bi-partition of a graph .