gcc.py 文件源码

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

项目:QTop 作者: jacobmarks 项目源码 文件源码
def GCC_Partition(UnclusteredGraph, scale):
    # Make edges on Unclustered graph
    # between all nodes separated by distance 'scale'
    for node1 in UnclusteredGraph.nodes():
        for node2 in UnclusteredGraph.nodes():
            if node1 != node2:
                dist = common.euclidean_dist(node1, node2)
                if dist <= scale:
                    UnclusteredGraph.add_edge(*(node1, node2), weight=dist)
    Clusters = []
    subgraphs = nx.connected_component_subgraphs(UnclusteredGraph)
    for i, sg in enumerate(subgraphs):
        Clusters.append(sg.nodes(data=True))

    return Clusters
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号