###
# function for finding indices of uid1 and uid2 in a list of tuples
# network = [(4, [6,8,9]), .......]
###
def findUserIndices(uid1, uid2, network):
found = 0 # reset the found
uid1_idx = None
uid2_idx = None
for idx,item in enumerate(network):
if item[0] == uid1:
uid1_idx = idx
found+=1
elif item[0] == uid2:
uid2_idx = idx
found+=1
if found==2: # Dont spend cpu cycles after finding the indices
break
return(uid1_idx, uid2_idx)
# function for finding indices of uid1 and uid2 in a list of tuples
# network = [(4, [6,8,9]), .......]
###
def findUserIndices(uid1, uid2, network):
found = 0 # reset the found
uid1_idx = None
uid2_idx = None
for idx,item in enumerate(network):
if item[0] == uid1:
uid1_idx = idx
found+=1
elif item[0] == uid2:
uid2_idx = idx
found+=1
if found==2: # Dont spend cpu cycles after finding the indices
break
return(uid1_idx, uid2_idx)