def test_to_coo_matrix(self): """ Test the generation of a sparse amtrix as output """ a = (np.random.randn(5, 5)>.8).astype(np.float) wg = fg.wgraph_from_adjacency(a) b = wg.to_coo_matrix().todense() self.assert_((a==b).all())
def test_graph_create_from_array(self): """ Test the creation of a graph from a sparse coo_matrix """ a = np.random.randn(5, 5) wg = fg.wgraph_from_adjacency(a) b = wg.adjacency() self.assert_((a==b).all())