def test_eigenvectors(self): np = pytest.importorskip("numpy") eigenval = np.linalg.eigvals scipy = pytest.importorskip("scipy") cs = "ddiiddid" G = nxt.threshold_graph(cs) (tgeval, tgevec) = nxt.eigenvectors(cs) dot = np.dot assert [abs(dot(lv, lv) - 1.0) < 1e-9 for lv in tgevec] == [True] * 8 lapl = nx.laplacian_matrix(G)
def test_eigenvectors(self): np = pytest.importorskip("numpy") eigenval = np.linalg.eigvals pytest.importorskip("scipy") cs = "ddiiddid" G = nxt.threshold_graph(cs) (tgeval, tgevec) = nxt.eigenvectors(cs) np.testing.assert_allclose([np.dot(lv, lv) for lv in tgevec], 1.0, rtol=1e-9) lapl = nx.laplacian_matrix(G)
def test_eigenvectors(self): try: import numpy as N eigenval=N.linalg.eigvals import scipy except ImportError: raise SkipTest('SciPy not available.') cs='ddiiddid' G=nxt.threshold_graph(cs) (tgeval,tgevec)=nxt.eigenvectors(cs) dot=N.dot assert_equal([ abs(dot(lv,lv)-1.0)<1e-9 for lv in tgevec ], [True]*8) lapl=nx.laplacian_matrix(G)
def test_eigenvectors(self): try: import numpy as N eigenval = N.linalg.eigvals import scipy except ImportError: raise SkipTest('SciPy not available.') cs = 'ddiiddid' G = nxt.threshold_graph(cs) (tgeval, tgevec) = nxt.eigenvectors(cs) dot = N.dot assert_equal([abs(dot(lv, lv) - 1.0) < 1e-9 for lv in tgevec], [True] * 8) lapl = nx.laplacian_matrix(G)