pathExecutor.py 文件源码

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

项目:Heft 作者: KeshShan 项目源码 文件源码
def findPaths(Graph, source, des, pathLen):
    #for path like V1//V2
    if pathLen == 0:
        #Old version find paths:
        #while True:
            #pathLen += 1
            #print source, des
            #paths = nx.all_simple_paths(Graph, source, des, pathLen)
            #if (len(pathList) != 0) or (pathLen == 3) :
            #if (pathLen == 3) :
                #pathLen = 0
                #break  
            #New version find paths:
        paths = nx.all_shortest_paths(Graph, source, des)
        pathList = list(paths)
        return pathList

    #for path like V1/./V2 with specific length
    else:
        paths = nx.all_simple_paths(Graph, source, des, pathLen)
        pathList = list(paths)
        return pathList
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号