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)
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)
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')
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)