Skip to content

similarity

Lazy generation of connectivity vector combinations.

Source code in navis/connectivity/similarity.py
188
189
190
191
192
193
194
195
def combinations_generator(func, adjacency, *args, **kwargs):
    """Lazy generation of connectivity vector combinations."""
    comb = product(adjacency.values, adjacency.values)
    for i in range(adjacency.shape[0]**2):
        this = next(comb)
        #non_zero = (this[0] > 0) | (this[1] > 0)
        #yield (func, this[0][non_zero], this[1][non_zero], args, kwargs)
        yield (func, this[0], this[1], args, kwargs)