How to use the leidenalg.SurpriseVertexPartition function in leidenalg

To help you get started, we’ve selected a few leidenalg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vtraag / leidenalg / tests / test_VertexPartition.py View on Github external
def setUp(self):
    super(SurpriseVertexPartitionTest, self).setUp();
    self.partition_type = leidenalg.SurpriseVertexPartition;
github logstar / scedar / scedar / cluster / community.py View on Github external
k=k, use_pca=use_pca, use_hnsw=use_hnsw,
                index_params=index_params, query_params=query_params,
                verbose=verbose)
            graph = SampleDistanceMatrix.knn_conn_mat_to_aff_graph(
                knn_conn_mat, aff_scale=aff_scale)

        if partition_method == "RBConfigurationVertexPartition":
            la_part_cls = la.RBConfigurationVertexPartition
        elif partition_method == "RBERVertexPartition":
            la_part_cls = la.RBERVertexPartition
        elif partition_method == "CPMVertexPartition":
            la_part_cls = la.CPMVertexPartition
        elif partition_method == "SignificanceVertexPartition":
            la_part_cls = la.SignificanceVertexPartition
        elif partition_method == "SurpriseVertexPartition":
            la_part_cls = la.SurpriseVertexPartition
        else:
            raise ValueError(
                "Unknown partition method: {}".format(partition_method))

        la_res = la.find_partition(graph, la.RBConfigurationVertexPartition,
                                   seed=random_state, weights='weight',
                                   resolution_parameter=resolution)
        # keep track of results and parameters
        self._graph = graph
        self._la_res = la_res
        self._labs = la_res.membership
        self._k = k
        self._use_pca = use_pca
        self._use_hnsw = use_hnsw
        self._index_params = index_params
        self._query_params = query_params