Skip to content

abeinstein/search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Four Search Methods Andrew Beinstein

I implemented four search methods: breadth first, depth first, uniform cost, and A* search.

The first three methods can be called from the command line, with one argument: python (bfs|ucs|dfs).py <file_path_of_cost_matrix>

The A* search must be called with two arguments: python astar.py <file_path_of_cost_matrix> <file_path_of_heuristic_matrix>

These methods will conduct a search from the first to the last node. They will output two text files: searched.txt and path.txt.

I wrote a Graph module to implement simple graph functions using a Python dictionary. I also used a modified library called priorityqueue, based off code provided in the Python documentation. Below is the breakdown for all the files in the directory.

bfs.py: Breadth first search ucs.py: Uniform cost search dfs.py: Depth first search astar.py: A* search graph.py: My module for implementing graphs. helper.py: Contains some helper functions that process the input and some visuzalizaion functions to help me debug. priorityqueue.py: Contains the priority queue module that is used in ucs.py and astar.py. examples: This directory contains the provided example matrices given through Chalk. searched.txt: One of the text files that will be outputted after running any of the four search functions. The file will overwrite after each call. path.txt: Same as above.

About

Implementation of BFS, DFS, Uniform, and A* search in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages