Exemplo n.º 1
0
def compute_lpa(n_vertex, edge_list):
    graph, weights = tf.compute_igraph_form(n_vertex, edge_list)

    t = time.time()
    clusters = graph.community_label_propagation(weights=weights, initial=None, fixed=None)
    exectime = time.time() - t

    labels = tf.compute_labels_from_clusters(n_vertex, clusters)

    return labels, clusters, exectime
Exemplo n.º 2
0
def compute_walktrap(n_vertex, edge_list, n_clusters, n_steps):
    graph, weights = tf.compute_igraph_form(n_vertex, edge_list)

    t = time.time()
    dendrogram = graph.community_walktrap(weights, n_steps)
    clusters = dendrogram.as_clustering(n=n_clusters)
    exectime = time.time() - t

    labels = tf.compute_labels_from_clusters(n_vertex, clusters)

    return labels, clusters, exectime
Exemplo n.º 3
0
def compute_clauset_newman(n_vertex, edge_list, n_clusters):

    graph, weights = tf.compute_igraph_form(n_vertex, edge_list)

    t = time.time()
    dendrogram = graph.community_fastgreedy(weights)
    clusters = dendrogram.as_clustering(n=n_clusters)
    exectime = time.time() - t

    labels = tf.compute_labels_from_clusters(n_vertex, clusters)

    return labels, clusters, exectime
Exemplo n.º 4
0
def compute_greedy_newman(n_vertex, edge_list):
    from agglomcluster import NewmanGreedy

    graph = tf.compute_networkx_form(n_vertex, edge_list)

    t = time.time()
    clst = NewmanGreedy(graph)
    clusters = clst.get_clusters()
    exectime = time.time() - t

    labels = tf.compute_labels_from_clusters(n_vertex, clusters)

    return labels, clusters, exectime