def setUp(self): example = { 1: { 2: { 'weight': 2 }, 3: { 'weight': 1 } }, 2: { 1: { 'weight': 2 }, 3: { 'weight': 3 }, 4: { 'weight': 1 } }, 3: { 1: { 'weight': 1 }, 2: { 'weight': 3 }, 4: { 'weight': 2 }, 5: { 'weight': 2 } }, 4: { 2: { 'weight': 1 }, 3: { 'weight': 2 }, 5: { 'weight': 1 }, 6: { 'weight': 3 } }, 5: { 3: { 'weight': 2 }, 4: { 'weight': 1 }, 6: { 'weight': 3 } }, 6: { 4: { 'weight': 3 }, 5: { 'weight': 3 } } } graph = nx.Graph(example) tree = { 1: { 2: { 'weight': 2 }, 3: { 'weight': 1 } }, 2: { 4: { 'weight': 1 } }, 4: { 5: { 'weight': 1 }, 6: { 'weight': 3 } } } self.tree = nx.Graph(tree) self.yamada = yamada.Yamada(graph)
def test_k5_termination(self): k5 = instantiate_k_graph(5) k5_yamada = yamada.Yamada(k5, 53) msts = k5_yamada.spanning_trees() self.assertTrue(len(msts) == 53)
def test_k6_termination(self): k6 = instantiate_k_graph(6) k6_yamada = yamada.Yamada(k6, 312) msts = k6_yamada.spanning_trees() self.assertTrue(len(msts) == 312)
def test_k3_termination(self): k3 = instantiate_k_graph(3) k3_yamada = yamada.Yamada(k3, n_trees=1) msts = k3_yamada.spanning_trees() self.assertTrue(len(msts) == 1)
def test_k4_termination(self): k4 = instantiate_k_graph(4) k4_yamada = yamada.Yamada(k4, n_trees=9) msts = k4_yamada.spanning_trees() self.assertTrue(len(msts) == 9)
def setUp(self): example = { 1: { 2: { 'weight': 2 }, 3: { 'weight': 1 } }, 2: { 1: { 'weight': 2 }, 3: { 'weight': 3 }, 4: { 'weight': 1 } }, 3: { 1: { 'weight': 1 }, 2: { 'weight': 3 }, 4: { 'weight': 2 }, 5: { 'weight': 2 } }, 4: { 2: { 'weight': 1 }, 3: { 'weight': 2 }, 5: { 'weight': 1 }, 6: { 'weight': 3 } }, 5: { 3: { 'weight': 2 }, 4: { 'weight': 1 }, 6: { 'weight': 3 } }, 6: { 4: { 'weight': 3 }, 5: { 'weight': 3 } } } self.graph = nx.Graph(example) graph_yamada = yamada.Yamada(self.graph) self.msts = graph_yamada.spanning_trees()
def setUp(self): k6 = instantiate_k_graph(6) k6_yamada = yamada.Yamada(k6) self.msts = k6_yamada.spanning_trees()
def setUp(self): k5 = instantiate_k_graph(5) k5_yamada = yamada.Yamada(k5) self.msts = k5_yamada.spanning_trees()
def setUp(self): k4 = instantiate_k_graph(4) k4_yamada = yamada.Yamada(k4) self.msts = k4_yamada.spanning_trees()
def setUp(self): k3 = instantiate_k_graph(3) k3_yamada = yamada.Yamada(k3) self.msts = k3_yamada.spanning_trees()