This commit is contained in:
Yomguithereal 2018-07-02 21:40:02 +02:00
parent 4e6dc205cd
commit ed1379f4fc
1 changed files with 19 additions and 0 deletions

View File

@ -367,6 +367,25 @@ def pairwise_connected_components(data, similarity=None, distance=None, radius=N
sets.union(i, j)
# Iterating over components
cindex = {}
# TODO: add this as a sparse option to phylactery
# for i, parent in enumerate(sets.parents):
# p = sets[i]
# if sets.cardinalities[p] < min_size:
# continue
# c = cindex.get(p)
# if c is None:
# cindex[p] = [data[i]]
# else:
# c.append(data[i])
# for cluster in cindex.values():
# yield cluster
for component in sets.components(min_size=min_size, max_size=max_size):
yield [data[i] for i in component]