def _csc_gen_triples(A):
 ncols = A.shape[1]
 (data, indices, indptr) = (A.data, A.indices, A.indptr)
 for i in range(ncols):
  for j in range(indptr[i], indptr[(i + 1)]):
   (yield (indices[j], i, data[j]))

def _csc_gen_triples ( A ) : ncols = A . shape [ 1 ] ( data , indices , indptr ) = ( A . data , A . indices , A . indptr ) for i in range ( ncols ) : for j in range ( indptr [ i ] , indptr [ ( i + 1 ) ] ) : ( yield ( indices [ j ] , i , data [ j ] ) )
converts a scipy sparse matrix in **compressed sparse column** format to an iterable of weighted edge triples .