Esempio n. 1
0
 def test_two_go(self):
     edges = [(1, 2), (2, 3), (3, 4)]
     G = nx.DiGraph()
     G.add_edges_from(edges)
     result = clean_graph(G)
     gold = [1, 4]
     self.assertItemsEqual(result, gold)
Esempio n. 2
0
 def test_complex(self):
     G = nx.DiGraph()
     G.add_edges_from([(1, 2), (2, 3)])
     gold = nx.DiGraph()
     gold.add_edges_from([(1, 3)])
     clean = clean_graph(G)
     self.assertEqual(clean.edges(), gold.edges())
Esempio n. 3
0
 def test_one_goes(self):
     edges = [(1, 2), (2, 3)]
     G = nx.DiGraph()
     G.add_edges_from(edges)
     result = clean_graph(G)
     gold = [1, 3]
     self.assertItemsEqual(result, gold)
Esempio n. 4
0
 def test_direct(self):
     edges = [(1, 2),]
     G = nx.DiGraph()
     G.add_edges_from(edges)
     result = clean_graph(G)
     gold = [1, 2]
     self.assertItemsEqual(result, gold)
Esempio n. 5
0
 def test_empty(self):
     edges = []
     G = nx.DiGraph()
     G.add_edges_from(edges)
     result = clean_graph(G)
     gold = []
     self.assertItemsEqual(result, gold)
Esempio n. 6
0
 def test_one(self):
     G = nx.DiGraph()
     G.add_node(1)
     clean = clean_graph(G)
     gold = {1}
     self.assertItemsEqual(clean.nodes(), gold)
Esempio n. 7
0
 def test_empty(self):
     G = nx.DiGraph()
     gold = nx.DiGraph()
     self.assertGraphEqual(clean_graph(G), gold)
     self.assertEqual(G.edges(), gold.edges())