当前位置: 首页>>代码示例>>Python>>正文


Python Graph.generateGraph方法代码示例

本文整理汇总了Python中Graph.generateGraph方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.generateGraph方法的具体用法?Python Graph.generateGraph怎么用?Python Graph.generateGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graph的用法示例。


在下文中一共展示了Graph.generateGraph方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testStepDistance

# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import generateGraph [as 别名]
def testStepDistance(location, connection):
    graph = Graph.generateGraph(location,connection)
    for start in graph:
        for end in graph:
            if start != end:
                assert(start.name != end.name)
                foo = AStar.AStarDistance(graph,start, end).runStepByStep()
                #print '({0},{1})'.format(start.name, end.name)
                for each in foo:
                    pass
开发者ID:kayslive,项目名称:astar,代码行数:12,代码来源:test.py

示例2: testNoneStopDistance

# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import generateGraph [as 别名]
def testNoneStopDistance(location, connection):
    graph = Graph.generateGraph(location,connection)
    for start in graph:
        for end in graph:
            if start != end:
                assert(start.name != end.name)
                try:
                    result = AStar.AStarDistance(graph,start, end).runNoneStop()
                    #print '({0},{1})'.format(start.name, end.name),
                except BaseException, e:
                    print
                    print str(e)
                    print '>>>Error: start {0}, end {0}'.format(start.name, end.name)
开发者ID:kayslive,项目名称:astar,代码行数:15,代码来源:test.py

示例3: OnLoad

# 需要导入模块: import Graph [as 别名]
# 或者: from Graph import generateGraph [as 别名]
    def OnLoad(self,evt):
        # if not points location file or connection file
        if self.cityPath == None or self.connectPath == None:
            dlg = wx.MessageDialog(self.frame, 'Please choose city file and connection file',
                               'File Error!',
                               wx.OK | wx.ICON_INFORMATION
                               )
            dlg.ShowModal()
            dlg.Destroy()
            return
        #if self.citys != None:
        #    print '- '.join([each.name for each in self.citys])
        #generate citys graph
        self.citys = Graph.generateGraph(self.cityPath, self.connectPath)
        #print '= '.join([each.name for each in self.citys])

        #if file invalid
        if self.citys == None:
            dlg = wx.MessageDialog(self.frame, 'Chosen Files contain invalid value!',
                               'File Error!',
                               wx.OK | wx.ICON_INFORMATION
                               )
            dlg.ShowModal()
            dlg.Destroy()
            return

        self.isStepStarted = False
        self.isResultValid = False
        self.dragCity = None
        self.dragPos = (-1,-1)
        self.txtOutput.WriteText("Load Successfully\n")
        self.SetChoice() # set items to start,city and delete city controls
        x,y = self.calcVirtualSize() # calculate canvas size
        self.pnlMain.SetVirtualSize((x,y)) # set canvas size
        #self.pnlMain.SetScrollRate(10,10)
        self.isLoad = True
        #self.draw()
        self.OnPaint(None)
开发者ID:kayslive,项目名称:astar,代码行数:40,代码来源:GUI.py


注:本文中的Graph.generateGraph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。