示例#1
0
 def test_degree_mixing_matrix_directed(self):
     a_result = np.array([[0, 0, 0, 0], [0, 0, 0, 2], [0, 1, 0, 1],
                          [0, 0, 0, 0]])
     a = mixing.degree_mixing_matrix(self.D, normalized=False)
     npt.assert_equal(a, a_result)
     a = mixing.degree_mixing_matrix(self.D)
     npt.assert_equal(a, a_result / float(a_result.sum()))
示例#2
0
 def test_degree_mixing_matrix_multigraph(self):
     a_result = np.array([[0, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 3],
                          [0, 0, 3, 0]])
     a = mixing.degree_mixing_matrix(self.M, normalized=False)
     npt.assert_equal(a, a_result)
     a = mixing.degree_mixing_matrix(self.M)
     npt.assert_equal(a, a_result / float(a_result.sum()))
示例#3
0
 def test_degree_mixing_matrix_selfloop(self):
     a_result=np.array([[0,0,0],
                        [0,0,0],
                        [0,0,2]]
                       )
     a=mixing.degree_mixing_matrix(self.S,normalized=False)
     npt.assert_equal(a,a_result)
     a=mixing.degree_mixing_matrix(self.S)
     npt.assert_equal(a,a_result/float(a_result.sum()))
示例#4
0
 def test_degree_mixing_matrix_undirected(self):
     a_result=np.array([[0,0,0],
                        [0,0,2],
                        [0,2,2]]
                       )
     a=mixing.degree_mixing_matrix(self.P4,normalized=False)
     npt.assert_equal(a,a_result)
     a=mixing.degree_mixing_matrix(self.P4)
     npt.assert_equal(a,a_result/float(a_result.sum()))
示例#5
0
 def test_degree_mixing_matrix_multigraph(self):
     a_result=np.array([[0,0,0,0],
                        [0,0,1,0],
                        [0,1,0,3],
                        [0,0,3,0]]
                       )
     a=mixing.degree_mixing_matrix(self.M,normalized=False)
     npt.assert_equal(a,a_result)
     a=mixing.degree_mixing_matrix(self.M)
     npt.assert_equal(a,a_result/float(a_result.sum()))