Project 1

Due 2/17

We are going to be creating a program in python that does breadth first search, depth first search, and uniform cost search. It should be run with the following command:

python Search.py inputTextFile.txt Breadth startNodeName goalNodeName outputFile.txt

Your program should read the graph in inputTextFile.txt and perform the search from the second argument (Breadth, Depth, or Uniform). The path from startNode to endNode should then be written to the file outputfile.txt. The outputfile should start with the startNode, and each subsequent line should be another node in the path, ending with the endNode. Nodes should be added to your stack or queue alphabetically, as we did in class.

The input file is going to have the following format:

A B 1
C D 2
A D 1
F J 4

Each line indicates the presence of a link; the first line here indicates that A links to B with a weight of 1. Note that this does NOT mean that B links to A.

You can submit your homework on the gl server with the command "submit cs471 proj1 Search.py". Please use python 3.

Here is a sample file and sample output for a path from A to G:

  1. Sample Input
  2. Breadth first solution
  3. Depth first solution
  4. Uniform cost solutions