@not_implemented_for('directed')
def common_neighbors(G, u, v):
 if (u not in G):
  raise nx.NetworkXError('u is not in the graph.')
 if (v not in G):
  raise nx.NetworkXError('v is not in the graph.')
 return (w for w in G[u] if ((w in G[v]) and (w not in (u, v))))

@ not_implemented_for ( 'directed' ) def common_neighbors ( G , u , v ) : if ( u not in G ) : raise nx . NetworkXError ( 'u is not in the graph.' ) if ( v not in G ) : raise nx . NetworkXError ( 'v is not in the graph.' ) return ( w for w in G [ u ] if ( ( w in G [ v ] ) and ( w not in ( u , v ) ) ) )
return the common neighbors of two nodes in a graph .