예제 #1
0
    def test_random_walks_random_graph(self):
        """Test that random walks have the right length and number."""
        graph = data_utils.load_random_graph()
        walk_length = 3
        n_walks_per_node = 1

        paths = graph.random_walk(walk_length=walk_length,
                                  n_walks_per_node=n_walks_per_node)

        result = [len(paths), len(paths[0])]
        expected = [len(graph.edges) * n_walks_per_node, walk_length + 1]

        self.assertAllClose(result, expected)
예제 #2
0
 def test_random_graph(self):
     """Test the correct number of edges and nodes for each graph."""
     graph = data_utils.load_random_graph()
     result = len(graph.edges) + len(graph.labels)
     expected = 20
     self.assertTrue(result == expected)