Ejemplo n.º 1
0
 def test_hierholzer_with_edges(self):
     algorithm = HierholzerWithEdges(self.G)
     algorithm.run(6)
     #expected_cycle = [6, 4, 0, 1, 4, 5, 2, 3, 5, 6]
     expected_cycle = [
         Edge(6, 4), Edge(4, 0), Edge(0, 1), Edge(1, 4),
         Edge(4, 5), Edge(5, 2), Edge(2, 3), Edge(3, 5), Edge(5, 6)]
     self.assertEqual(len(algorithm.eulerian_cycle), len(self.edges))
     self.assertEqual(algorithm.eulerian_cycle, expected_cycle)
Ejemplo n.º 2
0
 def test_hierholzer_with_edges(self):
     algorithm = HierholzerWithEdges(self.G)
     algorithm.run(6)
     #expected_cycle = [6, 4, 0, 1, 4, 5, 2, 3, 5, 6]
     expected_cycle = [
         Edge(6, 4), Edge(4, 0), Edge(0, 1), Edge(1, 4),
         Edge(4, 5), Edge(5, 2), Edge(2, 3), Edge(3, 5), Edge(5, 6)]
     self.assertEqual(len(algorithm.eulerian_cycle), len(self.edges))
     self.assertEqual(algorithm.eulerian_cycle, expected_cycle)