cnt = len(summary)
network = [[0] * cnt] * cnt
index = [x for x in summary]
for x, xvalue in enumerate(index):
    for y, yvalue in enumerate(index):
        common = len(set(summary[xvalue]) & set(summary[yvalue]))
network[x][y] = common
Подобие списков в Python — сравнение клиентов по их характеристикам