create_production_rules.py 文件源码

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

项目:HRG 作者: nddsg 项目源码 文件源码
def get_production_rule(G, child, itx):

    rhs = nx.Graph()
    for n in G.subgraph(child).nodes():
        rhs.add_node(n)
    for e in G.subgraph(child).edges():
        rhs.add_edge(e[0], e[1])

    # remove links between external nodes (edges in itx)
    for x in itertools.combinations(itx, 2):
        if rhs.has_edge(x[0], x[1]):
            rhs.remove_edge(x[0], x[1])

    return rhs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号