Starting from:

$30

CSCI390-Assignment 1 Solved

In this assignment, there are two python files: 

as1_bfs.py: we have already implemented the basic BFS algorithm, which can work properly with the non-loopy path.
as1_test.py: you can use this file to test your implementation. In this file, we included two data structures that reflect the tree. These are also the trees that we will use to grade your implementation.
Tasks: two functions need to be implemented:

def traverse(tree, init): BFS traversal function. This func accepts two inputs: the tree to traverse and the initial state. We already provided an example of how to run this func in the as1_test.py. Your task is to modify it to run with the loopy path. So far, if you try to traverse the tree_2 without a valid modification, your program crashes. (2 points)
def pathfinder(tree, init, goal): still BFS traversal function. However, this func accepts three inputs: the tree, the initial state, and the goal state. Your task is to find the solution from the initial state to the goal state even we have the loopy path in the tree. 

More products