def is_negatively_weighted(G, edge=None, weight='weight'):
 if (edge is not None):
  data = G.get_edge_data(*edge)
  if (data is None):
   msg = 'Edge {!r} does not exist.'.format(edge)
   raise nx.NetworkXError(msg)
  return ((weight in data) and (data[weight] < 0))
 return any((((weight in data) and (data[weight] < 0)) for (u, v, data) in G.edges(data=True)))

def is_negatively_weighted ( G , edge = None , weight = 'weight' ) : if ( edge is not None ) : data = G . get_edge_data ( * edge ) if ( data is None ) : msg = 'Edge {!r} does not exist.' . format ( edge ) raise nx . NetworkXError ( msg ) return ( ( weight in data ) and ( data [ weight ] < 0 ) ) return any ( ( ( ( weight in data ) and ( data [ weight ] < 0 ) ) for ( u , v , data ) in G . edges ( data = True ) ) )
returns true if g has negatively weighted edges .