def _node_redundancy(G, v):
 n = len(G[v])
 overlap = sum((1 for (u, w) in combinations(G[v], 2) if ((set(G[u]) & set(G[w])) - {v})))
 return ((2 * overlap) / (n * (n - 1)))

def _node_redundancy ( G , v ) : n = len ( G [ v ] ) overlap = sum ( ( 1 for ( u , w ) in combinations ( G [ v ] , 2 ) if ( ( set ( G [ u ] ) & set ( G [ w ] ) ) - { v } ) ) ) return ( ( 2 * overlap ) / ( n * ( n - 1 ) ) )
returns the redundancy of the node v in the bipartite graph g .