@not_implemented_for('undirected', 'multigraph')
def reciprocity(G, nodes=None):
 if (nodes is None):
  return overall_reciprocity(G)
 if (nodes in G):
  reciprocity = next(_reciprocity_iter(G, nodes))[1]
  if (reciprocity is None):
   raise NetworkXError('Not defined for isolated nodes.')
  else:
   return reciprocity
 return dict(_reciprocity_iter(G, nodes))

@ not_implemented_for ( 'undirected' , 'multigraph' ) def reciprocity ( G , nodes = None ) : if ( nodes is None ) : return overall_reciprocity ( G ) if ( nodes in G ) : reciprocity = next ( _reciprocity_iter ( G , nodes ) ) [ 1 ] if ( reciprocity is None ) : raise NetworkXError ( 'Not defined for isolated nodes.' ) else : return reciprocity return dict ( _reciprocity_iter ( G , nodes ) )
compute the reciprocity in a directed graph .