コード例 #1
0
    def test_required_and_prohibited_edges(self):
        net = network.random_network(self.nodes, required_edges=[(0,1), (3,0)],
                                     prohibited_edges=[(2,3), (1,4)])

        assert net.is_acyclic() == True and \
               (0,1) in net.edges and \
               (3,0) in net.edges and \
               (2,3) not in net.edges and \
               (1,4) not in net.edges
コード例 #2
0
    def test_required_and_prohibited_edges(self):
        net = network.random_network(self.nodes,
                                     required_edges=[(0, 1), (3, 0)],
                                     prohibited_edges=[(2, 3), (1, 4)])

        assert net.is_acyclic() == True and \
               (0,1) in net.edges and \
               (3,0) in net.edges and \
               (2,3) not in net.edges and \
               (1,4) not in net.edges
コード例 #3
0
ファイル: evaluator.py プロジェクト: BarryLee/pebl
    def randomize_network(self):
        """Randomize the network edges."""

        newnet = network.random_network(self.network.nodes)
        return self.score_network(newnet)
コード例 #4
0
    def randomize_network(self):
        """Randomize the network edges."""

        newnet = network.random_network(self.network.nodes)
        return self.score_network(newnet)
コード例 #5
0
 def test_prohibited_edges(self):
     net = network.random_network(self.nodes, prohibited_edges=[(0,1), (3,0)])
     assert net.is_acyclic() == True and \
            (0,1) not in net.edges and \
            (3,0) not in net.edges
コード例 #6
0
 def test_required_edges(self):
     net = network.random_network(self.nodes, required_edges=[(0,1), (3,0)])
     assert net.is_acyclic() == True and \
            (0,1) in net.edges and \
            (3,0) in net.edges
コード例 #7
0
 def test_acyclic(self):
     net = network.random_network(self.nodes)
     assert net.is_acyclic() == True, "Random network is acyclic."
コード例 #8
0
 def test_prohibited_edges(self):
     net = network.random_network(self.nodes,
                                  prohibited_edges=[(0, 1), (3, 0)])
     assert net.is_acyclic() == True and \
            (0,1) not in net.edges and \
            (3,0) not in net.edges
コード例 #9
0
 def test_required_edges(self):
     net = network.random_network(self.nodes,
                                  required_edges=[(0, 1), (3, 0)])
     assert net.is_acyclic() == True and \
            (0,1) in net.edges and \
            (3,0) in net.edges
コード例 #10
0
 def test_acyclic(self):
     net = network.random_network(self.nodes)
     assert net.is_acyclic() == True, "Random network is acyclic."