def compute(): MIN = 50 MAX =5000 step = 500 repetitions = 100 adjMatrix = [] alg = None network = None tempCommSum = 0 commTimes = [] tempAlgSum = 0 algTimes= [] for n in range(MIN, MAX, step): tempCommSum = 0 tempAlgSum = 0 for k in range(repetitions): adjMatrix = getYaoGraph(n, 8) network = Network(adjMatrix) alg = LogStar(network) for node in network.ndList: alg.initiateNode(node) alg.execute() print k tempAlgSum += alg.roundCounter tempCommSum += network.algCommRoundCounter print n, 'time: ', datetime.now() algTimes.append(tempAlgSum/float(repetitions)) commTimes.append(tempCommSum/float(repetitions)) # print times fileName = '/home/julka/100_reps/log_star_MIS_yao_graph_comm.txt' save(commTimes, fileName) fileName = '/home/julka/100_reps/log_star_MIS_yao_graph_alg.txt' save(algTimes, fileName)
def compute(): MIN = 50 MAX =5000 step = 500 repetitions = 100 adjMatrix = [] alg = None network = None tempCommSum = 0 commTimes = [] tempAlgSum = 0 algTimes = [] for n in range(MIN, MAX, step): tempCommSum = 0 tempAlgSum = 0 for k in range(repetitions): adjMatrix = getPlanarGraph(n) network = Network(adjMatrix) alg = FastMIS_v2(network) alg.execute() print k tempAlgSum += alg.roundCounter tempCommSum += network.algCommRoundCounter print n, 'time: ', datetime.now() algTimes.append(tempAlgSum/float(repetitions)) commTimes.append(tempCommSum/float(repetitions)) # print times fileName = '/home/julka/100_reps/fast_MIS_v2_planar_graph_comm.txt' save(commTimes, fileName) fileName = '/home/julka/100_reps/fast_MIS_v2_planar_graph_alg.txt' save(algTimes, fileName)