Bug fixes

This commit is contained in:
Sudipta Basak 2024-04-08 22:31:55 +00:00
parent 54ade6f429
commit 44c8dfaa7c
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions

View File

@ -37,10 +37,10 @@ def getNodeCountPerColumn(config):
colsSelected = random.sample(list(range(1, numberOfCols + 1)), chiC1 if _ < node1Count else chiC2)
for col in colsSelected:
if col in nodeCountPerColumn.keys():
nodeCountPerColumn[col][0 if _ < numOfNodes else 1] += 1
nodeCountPerColumn[col][0 if _ < node1Count else 1] += 1
else:
nodeCountPerColumn[col] = [0, 0]
nodeCountPerColumn[col][0 if _ < numOfNodes else 1] = 1
nodeCountPerColumn[col][0 if _ < node1Count else 1] = 1
return nodeCountPerColumn

View File

@ -20,11 +20,11 @@ def plotData(conf):
plt.clf()
def isGroupRecoverable(group, nodes, chi1, chi2, size, sizeK):
uniqueLines = set()
linesSelected = []
for g in group:
linesSelected = set(random.sample(list(range(1, size + 1)), chi1 if g < nodes[0] else chi2))
uniqueLines.union(linesSelected)
return len(uniqueLines) >= sizeK
linesSelected += list(random.sample(list(range(1, size + 1)), chi1 if g < nodes[0] else chi2))
uniqueLines = set(linesSelected)
return len(uniqueLines) >= sizeK, len(uniqueLines)
def isGConnected(deg, nodes, mal, config):
G = nx.random_regular_graph(deg, sum(nodes))
@ -54,10 +54,10 @@ def getNodeCountPerColumn(config, numOfNodes):
colsSelected = random.sample(list(range(1, numberOfCols + 1)), chiC1 if _ < node1Count else chiC2)
for col in colsSelected:
if col in nodeCountPerColumn.keys():
nodeCountPerColumn[col][0 if _ < numOfNodes else 1] += 1
nodeCountPerColumn[col][0 if _ < node1Count else 1] += 1
else:
nodeCountPerColumn[col] = [0, 0]
nodeCountPerColumn[col][0 if _ < numOfNodes else 1] = 1
nodeCountPerColumn[col][0 if _ < node1Count else 1] = 1
return nodeCountPerColumn