def setUp(self): graph_1_path = './test/fixtures/graph-1.txt' graph_2_path = './test/fixtures/graph-2.txt' self.graph_1 = graph.construct_graph_from_file(graph.AdjacencyList(), graph_1_path) self.graph_2 = graph.construct_graph_from_file(graph.AdjacencyList(), graph_2_path)
def setUp(self): graph_1_path = './test/fixtures/graph-1.txt' graph_2_path = './test/fixtures/graph-2.txt' self.graph_1s = [graph.AdjacencyList(), graph.AdjacencyMatrix(), graph.ObjectOriented()] self.graph_2s = [graph.AdjacencyList(), graph.AdjacencyMatrix(), graph.ObjectOriented()] self.graph_1s = list(map(construct_graph(graph_1_path), self.graph_1s)) self.graph_2s = list(map(construct_graph(graph_2_path), self.graph_2s))
def setUp(self): grid_1_path = './test/fixtures/grid-1.txt' grid_2_path = './test/fixtures/grid-2.txt' grid_3_path = './test/fixtures/grid-3.txt' grid_4_path = './test/fixtures/grid-4.txt' grid_5_path = './test/fixtures/grid-5.txt' self.graph_1s = [ graph.AdjacencyList(), graph.AdjacencyMatrix(), graph.ObjectOriented() ] self.graph_2s = [ graph.AdjacencyList(), graph.AdjacencyMatrix(), graph.ObjectOriented() ] self.graph_3s = [ graph.AdjacencyList(), graph.AdjacencyMatrix(), graph.ObjectOriented() ] self.graph_1s = list( map(construct_grid_graph(grid_1_path), self.graph_1s)) self.graph_2s = list( map(construct_grid_graph(grid_2_path), self.graph_2s)) self.graph_3s = list( map(construct_grid_graph(grid_3_path), self.graph_3s)) self.graph_4 = utils.parse_grid_file(graph.AdjacencyList(), grid_4_path) self.graph_4 = utils.parse_grid_file(graph.AdjacencyList(), grid_5_path)
def setUp(self): graph_1_path = './test/fixtures/graph-1.txt' graph_2_path = './test/fixtures/graph-2.txt' #graph_1_path = "C:\\Users\\Kumar\\Downloads\\CS4660\\cs4660-fall-2017-amanish05\\cs4660\\test\\fixtures\\graph-1.txt" #graph_2_path = 'C:\\Users\\Kumar\\Downloads\\CS4660\\cs4660-fall-2017-amanish05\\cs4660\\test\\fixtures\\graph-2.txt' self.graph_1 = graph.construct_graph_from_file(graph.AdjacencyList(), graph_1_path) self.graph_2 = graph.construct_graph_from_file(graph.AdjacencyList(), graph_2_path)
print("Queue size is: " + str(queue.qsize())) parent = queue.get() room = get_state(parent) neighbors.clear() neighbors = room['neighbors'] print("Constructed Graph: " + str(my_graph)) return my_graph if __name__ == "__main__": # Your code starts here empty_room = get_state('7f3dc077574c013d98b2de8f735058b4') print("Original JSON: " + str(empty_room)) graph = construct_graph_from_json(g.AdjacencyList(), empty_room) #print(transition_state(empty_room['id'], empty_room['neighbors'][0]['id'])) bfs_path = s.bfs(graph, g.Node('7f3dc077574c013d98b2de8f735058b4'), g.Node('f1f131f647621a4be7c71292e79613f9')) if bfs_path: print("Bfs_path: " + str(bfs_path)) else: print("Bfs_path: No Path Found") dijkstra_path = dijkstra_search(graph, g.Node('7f3dc077574c013d98b2de8f735058b4'), g.Node('f1f131f647621a4be7c71292e79613f9')) if dijkstra_path: print("Dijkstra_path: " + str(dijkstra_path)) else: