コード例 #1
0
ファイル: test_graphs.py プロジェクト: deong/merlin
 def test_outdegree4(self):
     numStates = 50
     numActions = 1000
     G = graphs.rand_graph_uniform_degree(numStates, numActions)
     for node in G:
         succ = [y for (x,y) in G.edges() if x==node]
         self.assertEqual(len(succ), numActions)
コード例 #2
0
ファイル: test_graphs.py プロジェクト: deong/merlin
 def test_connectedness(self):
     ntests = 50
     nsuccess = 0
     for test in range(ntests):
         numStates = npr.randint(100, 5000)
         numActions = npr.randint(2, 20)
         G = graphs.make_strongly_connected(graphs.rand_graph_uniform_degree(numStates, numActions))
         if nx.number_strongly_connected_components(G) == 1:
             nsuccess += 1
     self.assertEqual(nsuccess, ntests)