PathAnalysis.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:netra 作者: akshah 项目源码 文件源码
def analyze(self):

        results=[]

        #Making all of the possibilities
        allGraphs = product(*self.countries)

        for g in allGraphs:
            results.append(hasCycle(g))

        #Now searching for cycles
        #results = [hasCycle(graph) for graph in allGraphs]
        numCycles = results.count(True)

        #Seeing if it's definately an anomolous path
        if numCycles == len(results):
            self.result = 1
        #Seeing if it's only potentially anomolous    
        elif numCycles > 0:
            self.result = 2
        #Everying seems to be fine
        else:
            self.result = 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号