文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>dependency algorithm in python

dependency algorithm in python

时间:2008-03-20  来源:linuxGentoo

def resolve_dependency(start,graph,li):
    if not graph[start]:
        pass 
    else:
        for dep in graph[start]:
            resolve_dependency(dep,graph,li)
    if start not in li:
        li.append(start)

if __name__ == '__main__':
    graph = {'A':['D'],'B':['C'],'C':[],'D':['C']}
    start = 'D'
    li = []
    resolve_dependency(start,graph,li)
    li.pop()
    print li

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载