def _coo_gen_triples(A):
 (row, col, data) = (A.row, A.col, A.data)
 return zip(row, col, data)

def _coo_gen_triples ( A ) : ( row , col , data ) = ( A . row , A . col , A . data ) return zip ( row , col , data )
converts a scipy sparse matrix in **coordinate** format to an iterable of weighted edge triples .