pedWorks.py 文件源码

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

项目:PedWorks 作者: BrnCPrz 项目源码 文件源码
def cycle_detect(G):
    # G = nx.DiGraph object
    cycle_list = list(nx.simple_cycles(G))
    print '\n\tCycles detected for individuals: '
    for i in cycle_list:
        print '\t', i[0]

    rmCyNode = raw_input('\n\t> Remove nodes? (y/n): ')
    print rmCyNode
    if rmCyNode == 'y':
        for i in cycle_list:
            G.remove_node(i[0])
        print '\n\tNodes removed with success.'
        print '\n\tProceeding with the algorithm.'
    elif rmCyNode == 'n':
        print '\n\tCorrect pedigree errors before proceeding..'
        print '\n\tClosing PedWork.py session...'
        print '\n\tExit > OK!'
        sys.exit()
    else:
        print '\n\tPlease enter y/n.'
        sys.exit()

    return G
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号