本文整理汇总了Python中Euler.Euler.checkGraph方法的典型用法代码示例。如果您正苦于以下问题:Python Euler.checkGraph方法的具体用法?Python Euler.checkGraph怎么用?Python Euler.checkGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Euler.Euler
的用法示例。
在下文中一共展示了Euler.checkGraph方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GraphGui
# 需要导入模块: from Euler import Euler [as 别名]
# 或者: from Euler.Euler import checkGraph [as 别名]
#.........这里部分代码省略.........
def findBridges(self):
bridges = self.euler.find_bridges(self.scene.G)
print bridges
def generate(self, h_or_f):
generator = Generator()
nodesNumberStr = self.nodesNumberInput.text()
edgesNumberStr = self.edgesNumberInput.text()
if nodesNumberStr == "" or edgesNumberStr == "":
return
nodeNumber = int(nodesNumberStr)
edgesNumber = int(edgesNumberStr)
G = None
if h_or_f == "FULL":
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))
示例2: avg
# 需要导入模块: from Euler import Euler [as 别名]
# 或者: from Euler.Euler import checkGraph [as 别名]
edgeIndex = sys.argv.index("-e")
edgeCount = sys.argv[edgeIndex + 1]
t = timeit.Timer("Generator().generate_half_euler_graph("+nodeCount+","+edgeCount+")",
"from Generator import Generator")
times = t.repeat(5,10)
print avg(times)
elif s == "-i":
dFile = sys.argv.index("-i")
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)",