Example #1
0
    def test_fine_tuned_modularity_seed(self):

        community_array = fine_tuned_clustering_q(self.G, seed=2)

        computed_metric = modularity_r(self.adj, community_array,
                                       np.unique(community_array))

        assert_equal(round(computed_metric, 4), 0.4198)
Example #2
0
    def test_fine_tuned_modularity_r(self):

        community_array = fine_tuned_clustering_q(self.G, r=2.0, seed=100)

        computed_metric = modularity_r(self.adj,
                                       community_array,
                                       np.unique(community_array),
                                       r=2.0)

        assert_equal(round(computed_metric, 4), 0.5148)
Example #3
0
    def test_fine_tuned_modularity_method3(self):

        community_array = fine_tuned_clustering_q(self.G,
                                                  evd_method='lobpcg',
                                                  seed=100)

        computed_metric = modularity_r(self.adj, community_array,
                                       np.unique(community_array))

        assert_equal(round(computed_metric, 4), 0.4198)
Example #4
0
    def test_constrained_fine_tuned_modularity_size2(self):

        community_array = \
                    constrained_fine_tuned_clustering_q(self.G,
                                                        cluster_size=10,
                                                        seed=100)

        computed_metric = modularity_r(self.adj, community_array,
                                       np.unique(community_array))

        assert_equal(round(computed_metric, 4), 0.3909)
Example #5
0
    def test_fine_tuned_modularity_2(self):

        community_array = fine_tuned_clustering_q(self.G,
                                                  normalize=False,
                                                  r=2,
                                                  evd_method='lobpcg',
                                                  seed=2)

        computed_metric = modularity_r(self.adj,
                                       community_array,
                                       np.unique(community_array),
                                       r=2)

        assert_equal(round(computed_metric, 4), 0.5153)