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(network) alg.execute() print k tempAlgSum += alg.roundCounter tempCommSum += network.algCommRoundCounter print n, 'time: ', datetime.now() commTimes.append(tempCommSum/float(repetitions)) algTimes.append(tempAlgSum/float(repetitions)) fileName = '/home/julka/100_reps/fast_MIS_planar_graph_comm.txt' save(commTimes, fileName) fileName = '/home/julka/100_reps/fast_MIS_planar_graph_alg.txt' save(algTimes, fileName)
def test_execute(self): adjacencyMatrix = getUnitDiskGraph(200) network = Network(adjacencyMatrix) alg = FastMIS(network) alg.execute() # self.drawGraph(network.ndList, adjacencyMatrix) # sprawdzenie wlasnosci wyliczonego MIS self.checkIfMISisCorrect(network.ndList) # graf Yao adjacencyMatrix = getYaoGraph(15, 6) network = Network(adjacencyMatrix) alg = FastMIS(network) alg.execute() self.drawGraph(network.ndList, adjacencyMatrix) # sprawdzenie wlasnosci wyliczonego MIS self.checkIfMISisCorrect(network.ndList) # graf planarny adjacencyMatrix = getPlanarGraph(10) network = Network(adjacencyMatrix) alg = FastMIS(network) alg.execute() self.drawGraph(network.ndList, adjacencyMatrix) # sprawdzenie wlasnosci wyliczonego MIS self.checkIfMISisCorrect(network.ndList)