-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestunit.py
More file actions
30 lines (28 loc) · 1.04 KB
/
Copy pathtestunit.py
File metadata and controls
30 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# def mergeConnectedGraph(listSetSimilarity):
# numConfirm = 0
# listToNext = listSetSimilarity
#
# while numConfirm != len(listToNext):
# listToMerge = listToNext
# listToNext = []
# numConfirm = 0
#
# waitSetList = [True for _ in range(len(listToMerge))]
#
# for i,setBased in enumerate(listToMerge):
# for j, setTargeted in enumerate(listToMerge):
# if waitSetList[i] and waitSetList[j] and i != j:
# if len(setTargeted & setBased) > 0:
# listToNext.append(setTargeted|setBased)
# waitSetList[i] = False
# waitSetList[j] = False
# break
# if waitSetList[i]:
# listToNext.append(setBased)
# waitSetList[i] = False
# numConfirm += 1
#
# return listToNext
#
# a = [{0,4},{0,5},{1,2},{5,6}]
# print mergeConnectedGraph(a)