示例#1
0
 def test_graph(self):
     G = nx.barbell_graph(5, 0)
     S = set(range(5))
     T = set(G) - S
     expansion = nx.edge_expansion(G, S, T)
     expected = 1 / 5
     assert expected == expansion
     # Test with no input T
     assert expected == nx.edge_expansion(G, S)
示例#2
0
 def test_graph(self):
     G = nx.barbell_graph(5, 0)
     S = set(range(5))
     T = set(G) - S
     expansion = nx.edge_expansion(G, S, T)
     expected = 1 / 5
     assert_equal(expected, expansion)
示例#3
0
 def test_graph(self):
     G = nx.barbell_graph(5, 0)
     S = set(range(5))
     T = set(G) - S
     expansion = nx.edge_expansion(G, S, T)
     expected = 1 / 5
     assert_equal(expected, expansion)
 def cut_edge_expansion(self, set_A, set_B):
     return nx.edge_expansion(self.G, set_A, set_B, weight='weight')