本文整理汇总了Python中Euler.Euler.start方法的典型用法代码示例。如果您正苦于以下问题:Python Euler.start方法的具体用法?Python Euler.start怎么用?Python Euler.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Euler.Euler
的用法示例。
在下文中一共展示了Euler.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GraphGui
# 需要导入模块: from Euler import Euler [as 别名]
# 或者: from Euler.Euler import start [as 别名]
#.........这里部分代码省略.........
G = generator.generate_full_euler_graph(nodeNumber, edgesNumber)
elif h_or_f == "HALF":
G = generator.generate_half_euler_graph(nodeNumber, edgesNumber)
if G is not None:
self.scene.clear()
self.scene.drawGraph(G)
self.setInfo()
def setInfo(self):
self.edgeInfo.setText("E: " + str(len(self.scene.G.edges())))
self.nodeInfo.setText("N: " + str(len(self.scene.G.nodes())))
info, odds = self.euler.checkGraph(self.scene.G)
self.eulerInfo.setText(info)
def generateHalf(self):
self.generate("HALF")
def generateFull(self):
self.generate("FULL")
def add(self):
self.scene.add()
self.setInfo()
def delete(self):
self.scene.delete()
self.setInfo()
def findEulerPath(self):
eulerPath = self.euler.start(self.scene.getGraph())
print eulerPath
if eulerPath is not None and len(eulerPath) > 0:
self.enableSlider(len(eulerPath))
self.eulerPath = eulerPath
def setEulerStep(self, stepNum):
self.scene.setColorForAllEdges(QColor.fromRgb(0, 0, 0))
if stepNum > 0:
for i in range(stepNum):
node1 = self.eulerPath[i]
node2 = self.eulerPath[i + 1]
self.scene.setColorForEdge(node1, node2, QColor.fromRgb(0, 255, 0))
def resizeEvent(self, event):
w = self.view.width() - 10
h = self.view.height() - 10
transform = QTransform.fromScale(w, h)
self.view.setTransform(transform)
QWidget.resizeEvent(self, event)
def enableSlider(self, maximum):
self.stepSlider.setEnabled(True)
self.stepSlider.setMinimum(0)
self.stepSlider.setMaximum(maximum - 1)
def disableSlider(self):
self.stepSlider.setDisabled(False)
示例2: GraphFile
# 需要导入模块: from Euler import Euler [as 别名]
# 或者: from Euler.Euler import start [as 别名]
fileTemp = sys.argv[dFile+1]
graphFile = GraphFile(fileTemp)
(G, pos, nodesNumber, edgesNumber) = graphFile.load()
euler = Euler()
(info,odds) = euler.checkGraph(G)
print info
print "Edges: "+str(nodesNumber)
print "Nodes: "+str(edgesNumber)
elif s == "-e":
dFile = sys.argv.index("-e")
fileTemp = sys.argv[dFile+1]
graphFile = GraphFile(fileTemp)
(G, pos, nodesNumber, edgesNumber) = graphFile.load()
euler = Euler()
path = euler.start(G)
print path
elif s == "-et":
t = timeit.Timer("euler.start(G)",
"from GraphFile import GraphFile\n"+
"from Euler import Euler\n"+
"import sys\n"+
"dFile = sys.argv.index(\"-et\")\n"+
"fileTemp = sys.argv[dFile+1]\n"+
"graphFile = GraphFile(fileTemp)\n"+
"(G, pos, nodesNumber, edgesNumber) = graphFile.load()\n"+
"euler = Euler()\n"
)
times = t.repeat(100,10)
print avg(times)