コード例 #1
0
ファイル: test_graphs.py プロジェクト: mirjunaid26/pygsp
    def test_differential_operator(self):
        G = graphs.StochasticBlockModel(N=100, directed=False)
        L = G.D.T.dot(G.D)
        np.testing.assert_allclose(L.toarray(), G.L.toarray())

        G = graphs.StochasticBlockModel(N=100, directed=True)
        self.assertRaises(NotImplementedError, G.compute_differential_operator)
コード例 #2
0
ファイル: test_graphs.py プロジェクト: mirjunaid26/pygsp
    def test_edge_list(self):
        G = graphs.StochasticBlockModel(N=100, directed=False)
        v_in, v_out, weights = G.get_edge_list()
        self.assertEqual(G.W[v_in[42], v_out[42]], weights[42])

        G = graphs.StochasticBlockModel(N=100, directed=True)
        self.assertRaises(NotImplementedError, G.get_edge_list)
コード例 #3
0
ファイル: test_graphs.py プロジェクト: mirjunaid26/pygsp
    def test_laplacian(self):
        # TODO: should test correctness.

        G = graphs.StochasticBlockModel(N=100, directed=False)
        self.assertFalse(G.is_directed())
        G.compute_laplacian(lap_type='combinatorial')
        G.compute_laplacian(lap_type='normalized')

        G = graphs.StochasticBlockModel(N=100, directed=True)
        self.assertTrue(G.is_directed())
        G.compute_laplacian(lap_type='combinatorial')
        self.assertRaises(NotImplementedError, G.compute_laplacian,
                          lap_type='normalized')
コード例 #4
0
ファイル: test_graphs.py プロジェクト: mirjunaid26/pygsp
 def test_stochasticblockmodel(self):
     graphs.StochasticBlockModel(N=100, directed=True)
     graphs.StochasticBlockModel(N=100, directed=False)
     graphs.StochasticBlockModel(N=100, self_loops=True)
     graphs.StochasticBlockModel(N=100, self_loops=False)
     graphs.StochasticBlockModel(N=100, connected=True)
     graphs.StochasticBlockModel(N=100, connected=False)
     self.assertRaises(ValueError, graphs.StochasticBlockModel,
                       N=100, p=0, q=0, connected=True)