def _generate_weighted_edges(A):
 if (A.format == 'csr'):
  return _csr_gen_triples(A)
 if (A.format == 'csc'):
  return _csc_gen_triples(A)
 if (A.format == 'dok'):
  return _dok_gen_triples(A)
 return _coo_gen_triples(A.tocoo())

def _generate_weighted_edges ( A ) : if ( A . format == 'csr' ) : return _csr_gen_triples ( A ) if ( A . format == 'csc' ) : return _csc_gen_triples ( A ) if ( A . format == 'dok' ) : return _dok_gen_triples ( A ) return _coo_gen_triples ( A . tocoo ( ) )
returns an iterable over triples .