def _apply_prediction(G, func, ebunch=None):
 if (ebunch is None):
  ebunch = nx.non_edges(G)
 return ((u, v, func(u, v)) for (u, v) in ebunch)

def _apply_prediction ( G , func , ebunch = None ) : if ( ebunch is None ) : ebunch = nx . non_edges ( G ) return ( ( u , v , func ( u , v ) ) for ( u , v ) in ebunch )
applies the given function to each edge in the specified iterable of edges .