def graphGenerate(self): try: numbersOfTop = int(self.numbersOfTopInput.text()) valueOfArc = int(self.valueOfArcInput.text()) myGraph = MyGraph() myGraph.addRandomTopsAndArcs(numbersOfTop, valueOfArc) current_milli_time = lambda: int(round(time.time() * 1000)) timeOd = current_milli_time() path = myGraph.hamiltonCycle() timeDo = current_milli_time() time1 = (timeDo - timeOd) * 0.001 timeOd = current_milli_time() pathP = myGraph.hamiltonCycleAllPath( ) #aby wyłączyć algorytm dokładny zakomentować linijkę timeDo = current_milli_time() time2 = (timeDo - timeOd) * 0.001 self.neighborhoodList.setText("<b>Lista sąsiedztwa:</b> <br>%s" % myGraph) self.cycleP.setText( "<b>Wartość cyklu (dokładny):</b> %d<br>%s" % (pathP.getValue(), pathP)) #aby wyłączyć algorytm dokładny zakomentować linijkę self.cycle.setText("<b>Wartość cyklu:</b> %d<br>%s" % (path.getValue(), path)) self.timeP.setText("<b>Czas dokładny:</b> %s [s]" % time2) self.time.setText("<b>Czas:</b> %s [s]" % time1) graphPlot = GraphPlot() graphPlot.drawGraphPlot( myGraph, pathP) #aby wyłączyć algorytm dokładny zakomentować linijkę #graphPlot.drawGraphPlot(myGraph, path) #aby wyłączyć algorytm dokładny ODKOMENTOWAć linijkę self.close() except ValueError: QMessageBox.warning(self, "Błąd", "Błędne dane", QMessageBox.Ok)