Ejemplo n.º 1
0
 def test_dijkstra(self):
     print "Dijkstra"
     name = "graph3"
     p = "/Users/sacry/dev/uni/s3/WS1314/GKA/graphs/"+name+".graph"
     gp = GraphParser(p, name)
     g = gp.createGraph()
     l = graph_algorithms.shortestDijkstra(g, "y", "u", "d")
     shortest_path_as_names = map(lambda x: x.name(), l)
     self.assertEqual(["y","s","x","u"], shortest_path_as_names)
Ejemplo n.º 2
0
 def test_graph_parser(self):
     print "Graph Parsing"
     name = "graph1"
     p = getcwd() + "/graphs/old/" + name + ".graph"
     gp = GraphParser(p, name)
     g = gp.createGraph()
     self.assertTrue(not g.empty())
     actual_neighbours = set(["Neumünster", "Bremen", "Berlin", "Hannover","Lüneburg","Lübeck"])
     expected_neighbours = g.neighbours("Hamburg")
     self.assertEqual(actual_neighbours, expected_neighbours)
     hamburg = g.vertice("Hamburg")
     self.assertTrue("Hamburg", hamburg.name())
     print g