Example #1
0
 def test_transition_graph_fixed_sized(self):
     """
     ``transitions_graph`` should raise an error if ``net`` is fixed sized
     and ``size`` is not ``None``
     """
     with self.assertRaises(ValueError):
         transition_graph(MockFixedSizedNetwork(), size=5)
Example #2
0
 def test_transition_graph_variable_sized(self):
     """
     ``transitions_graph`` should raise an error if ``net`` is variable
     sized and ``size`` is ``None``
     """
     with self.assertRaises(ValueError):
         transition_graph(ECA(30))
Example #3
0
 def test_transition_graph_eca(self):
     """
     test ``transitions_graph`` on ``ECA``
     """
     graph = transition_graph(ECA(30), size=8)
     self.assertEqual(256, graph.number_of_nodes())
     self.assertEqual(256, graph.number_of_edges())
Example #4
0
    def test_basin_entropy_transition_graph(self):
        """
        test ``basin_entropy`` on ``s_pombe`` transition graph
        """
        from_graph = basin_entropy(transition_graph(s_pombe))
        from_network = basin_entropy(s_pombe)

        self.assertAlmostEqual(from_network, from_graph)
Example #5
0
 def test_transition_graph_s_pombe(self):
     """
     test ``transitions_graph`` on ``s_pombe``
     """
     volume = s_pombe.state_space().volume
     graph = transition_graph(s_pombe)
     self.assertEqual(volume, graph.number_of_nodes())
     self.assertEqual(volume, graph.number_of_edges())
Example #6
0
    def test_basins_transition_graph(self):
        """
        test ``basins`` on ``s_pombe`` transition graph
        """
        from_graph = basins(transition_graph(s_pombe))
        from_network = basins(s_pombe)

        edges_from_graph = [g.edges() for g in from_graph]
        edges_from_network = [g.edges() for g in from_network]

        self.assertEqual(edges_from_network, edges_from_graph)
Example #7
0
    def test_attractors_transition_graph(self):
        """
        test ``attractors`` on ``s_pombe`` transition graph
        """
        att_from_graph = attractors(transition_graph(s_pombe))
        att_from_network = attractors(s_pombe)

        for (a, b) in zip(att_from_graph, att_from_network):
            a.sort()
            b.sort()

        att_from_graph.sort()
        att_from_network.sort()

        self.assertEqual(att_from_network, att_from_graph)
Example #8
0
 def test_transition_graph_not_network(self):
     """
     ``transitions_graph`` should raise an error if ``net`` is not a network
     """
     with self.assertRaises(TypeError):
         transition_graph(MockObject())