本文整理汇总了Python中Euler.Euler.find_bridges方法的典型用法代码示例。如果您正苦于以下问题:Python Euler.find_bridges方法的具体用法?Python Euler.find_bridges怎么用?Python Euler.find_bridges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Euler.Euler
的用法示例。
在下文中一共展示了Euler.find_bridges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GraphGui
# 需要导入模块: from Euler import Euler [as 别名]
# 或者: from Euler.Euler import find_bridges [as 别名]
#.........这里部分代码省略.........
self.generateHalfButton.clicked.connect(self.generateHalf)
# self.testButton.clicked.connect(self.scene.changeColor)
self.saveAsButton.clicked.connect(self.saveAsFile)
self.saveButton.clicked.connect(self.saveFile)
self.loadButton.clicked.connect(self.loadFile)
self.scene.cursorPositionSignal.connect(self.setLabels)
self.scene.nodeNumberSignal.connect(self.setLabelNumber)
self.stepSlider.sliderMoved.connect(self.setEulerStep)
self.bridgeButton.clicked.connect(self.findBridges)
self.infoButton.clicked.connect(self.setInfo)
self.view.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
layoutH = QHBoxLayout()
layoutH.addWidget(self.view)
layoutH.addItem(self.modeButtonGroup)
layoutV = QVBoxLayout()
layoutV.addItem(self.topGroup)
layoutV.addItem(layoutH)
self.setLayout(layoutV)
self.setWindowTitle("Example")
self.scene.setSceneRect(0, 0, 1, 1)
self.view.setMouseTracking(True)
self.showMaximized()
self.graphFile = GraphFile("file.txt")
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)