Code Monkey home page Code Monkey logo

bfs-algorithm's Introduction

Your Repository's Stats Your Repository's Stats

GitHub stars GitHub forks

Breadth-First Search (BFS) Algorithm

Introduction

The following Python libraries were utilized: random, time, os, and matplotlib. The Random_Maze.py file generates a random maze with obstacles accounting for 30% of the total maze size. This newly generated maze is then saved as a .txt file which then gets opened and read in the Grid_Maze_Search.py file. The Grid_Maze_Search.py file solves the maze by first reading the maze from a text file from a directory and then using Breadth-First-Search (BFS) solving the maze. Cost function was also computed for each maze size by dividing the number of moves it took to solve the maze by the solve time. The start point on the maze is marked with “S” at the top left corner of the maze. The goal point of the maze is marked with “G” at the bottom right corner of the maze. Randomly generated obstacles are marked with “O” on the maze. The point robot is not allowed to visit an obstacle cell. The point robot is supposed to traverse the maze horizontally.

Results

Image below summarizes the cost function for each grid(maze) problem. The BFS algorithm per the data below indicates that the cost function decrease as maze size increases. It can be observed that the maze size of 500x500 has the lowest cost function from the rest of the maze sizes.

Maze 10x10

The solved path provided by the algorithm is provided in the image below as an array. The “S” start position is always (0,0). The path values are also plotted as shown below.

Maze 50x50

The solved path provided by the algorithm is provided in the image below as an array. The “S” start position is always (0,0). The path values are also plotted as shown below.

Maze 100x100

The solved path provided by the algorithm is provided in the image below as an array. The “S” start position is always (0,0). The path values are also plotted as shown below.

Maze 500x500

The solved path provided by the algorithm is provided in the image below as an array. The “S” start position is always (0,0). The path values are also plotted as shown below.

https://abedinsherifi.github.io/BFS-Algorithm/

bfs-algorithm's People

Contributors

abedinsherifi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.