{"id":19053357,"url":"https://github.com/georgiosioannoucoder/dfs-bfs","last_synced_at":"2025-06-23T20:02:29.017Z","repository":{"id":205017535,"uuid":"713210681","full_name":"GeorgiosIoannouCoder/dfs-bfs","owner":"GeorgiosIoannouCoder","description":"Depth First Search (DFS) and Breadth First Search (BFS) on a 2D-Grid. 🔍","archived":false,"fork":false,"pushed_at":"2023-11-07T04:48:24.000Z","size":362,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T10:45:41.770Z","etag":null,"topics":["2d-grid","breadth-first-search","depth-first-search","queue","shortest-path-algorithm","stack"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GeorgiosIoannouCoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-02T03:52:30.000Z","updated_at":"2023-11-02T10:27:10.000Z","dependencies_parsed_at":"2023-11-07T05:56:14.112Z","dependency_job_id":null,"html_url":"https://github.com/GeorgiosIoannouCoder/dfs-bfs","commit_stats":null,"previous_names":["georgiosioannoucoder/dfs-bfs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgiosIoannouCoder%2Fdfs-bfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgiosIoannouCoder%2Fdfs-bfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgiosIoannouCoder%2Fdfs-bfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeorgiosIoannouCoder%2Fdfs-bfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeorgiosIoannouCoder","download_url":"https://codeload.github.com/GeorgiosIoannouCoder/dfs-bfs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240109714,"owners_count":19749181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d-grid","breadth-first-search","depth-first-search","queue","shortest-path-algorithm","stack"],"created_at":"2024-11-08T23:30:22.517Z","updated_at":"2025-02-22T01:16:21.777Z","avatar_url":"https://github.com/GeorgiosIoannouCoder.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url]\n[![LinkedIn][linkedin-shield]][linkedin-url]\n[![GitHub][github-shield]][github-url]\n\n# [dfs-bfs] | Depth First Search - Breadth First Search On A 2D-Grid\n\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"dfs-bfs.png\" alt=\"Logo\" width=\"400\" height=\"200\"\u003e\n\n\n\u003ch3 align=\"center\"\u003eDepth First Search - Breadth First Search\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    Depth First Search - Breadth First Search On A 2D-Grid allows people to traverse and search for a particular cell/vertex/node/number in a 2D-Grid.\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/GeorgiosIoannouCoder/dfs-bfs\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/GeorgiosIoannouCoder/dfs-bfs/issues\"\u003eReport Bug\u003c/a\u003e\n    \u003ca href=\"https://github.com/GeorgiosIoannouCoder/dfs-bfs/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n      \u003cul\u003e\n         \u003cli\u003e\u003ca href=\"#problem-statement\"\u003eProblem Statement\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#key-features\"\u003eKey Features\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#setup\"\u003eSetup\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e\n     \u003cli\u003e\u003ca href=\"#reports\"\u003eReports\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n## About The Project\n\n![Project Name Screen Shot][project-screenshot]\n\n- **Depth First Search - Breadth First Search On A 2D-Grid allows people to traverse and search a particular number in a 2D-Grid.**\n- **Depth-First Search (DFS) and Breadth-First Search (BFS) are two techniques of traversing graphs and trees. DFS explores a graph or tree by diving as deeply as possible along a branch before backtracking, making it well-suited for tasks like finding paths and topological sorting. It is implemented using the stack data structure and recursion. Arrays/Lists can be used to implement the stack data structure.**\n- **BFS systematically explores all neighbors of a node before moving to their neighbors, making it ideal for finding the shortest path in unweighted graphs and efficiently visiting nodes level by level. BFS employs a queue to maintain a first-in-first-out order, allowing them to serve different graph exploration needs.**\n\n### Problem Statement\n\n1. Given the 2D-Grid in the below Figure, start at the black 1 position and reach the goal at the red 15 position. Find the path to the goal using:\n   1. Depth First Search (DFS)\n   2. Breadth First Search (BFS)\n\n\u003cimg src=\"2d_grid.png\" alt=\"Grid\" width=\"\" height=\"\"\u003e\n\n### Key Features\n\n1. **Usually we see Depth-First Search (DFS) and Breadth-First Search (BFS) on a Tree. However, they can also be used in a graph or grid which is what we do here.**\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to top\u003c/a\u003e\u003c/p\u003e\n\n### Built With\n\n[![Python][Python]][Python-url]\n[![JupyterNotebook][JupyterNotebook]][JupyterNotebook-url]\n\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to top\u003c/a\u003e\u003c/p\u003e\n\n## Getting Started\n\n**To get a local copy of the Depth First Search - Breadth First Search On A 2D-Grid up and running locally follow these simple example steps:**\n\n### Prerequisites\n\n**NOTE:** How to check if Python is installed and what is its version\n\n```sh\n  python --version\n```\n\n**NOTE:** How to check if Git is installed and what is its version\n\n```sh\n  git -v\n```\n\n1. Please make sure you have pyenv installed and use any Python3 version:\n\n   - You can use pyenv to switch between different Python versions:\n     - Windows: [https://www.youtube.com/watch?v=HTx18uyyHw8](https://github.com/pyenv-win/pyenv-win)\n     - Mac: [https://www.youtube.com/watch?v=31WU0Dhw4sk](https://github.com/pyenv/pyenv)\n     - Linux: [https://www.youtube.com/watch?v=1Zgo8M9yUtM](https://github.com/pyenv/pyenv)\n\n2. Please make sure you have git installed\n\n   - Windows: [https://git-scm.com/download/win](https://git-scm.com/download/win)\n   - Mac: [https://git-scm.com/download/mac](https://git-scm.com/download/mac)\n   - Linux: [https://git-scm.com/download/linux](https://git-scm.com/download/linux)\n\n### Setup\n\n1. Navigate to the directory where you want to clone/run/save the application\n\n   ```sh\n   cd your_selected_directory\n   ```\n\n2. Clone this repository\n\n   ```sh\n   git clone https://github.com/GeorgiosIoannouCoder/dfs-bfs.git\n   ```\n\n3. Navigate to the dfs-bfs git repository\n\n   ```sh\n   cd dfs-bfs\n   ```\n\n4. Use any Python3 version in the cloned repository folder:\n\n   ```sh\n   pyenv local 3.xx.xx\n   ```\n\n5. Create virtual environment in the cloned repository folder\n\n   ```sh\n   python -m venv .dfs-bfs-venv\n   ```\n\n6. Activate the virtual environment (Windows OR Mac/Linux):\n   1. Windows\n\n   ```sh\n   .\\.dfs-bfs-venv\\Scripts\\activate\n   ```\n\n   2. Mac/Linux\n\n   ```sh\n   source .dfs-bfs/bin/activate\n   ```\n\n7. Install ipykernel:\n\n   ```sh\n   pip install ipykernel\n   ```\n\n8. Install Jupyter Notebook:\n\n   ```sh\n   pip install jupyter notebook\n   ```\n\n9.  Add the kernel of the virtual environment in the Jupyter Notebook:\n\n   ```sh\n   ipython kernel install --user --name=.dfs-bfs-venv\n   ```\n\n10. Run the Jupyter Notebook:\n\n   ```sh\n   jupyter notebook\n   ```\n\n11. Select the .dfs-bfs-venv kernel to run the Jupyter Notebook.\n    \n12. Run the two notebooks found in this repository.\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to top\u003c/a\u003e\u003c/p\u003e\n\n## Usage\n\n1. Define/Input a grid, starting cell, goal cell, and traversal directions, use Depth First Search (DFS) or Breadth First Search (BFS) to find the goal cell in the 2D-Grid.\n2. You can use the two notebooks above for both [Depth First Search (DFS)](https://github.com/GeorgiosIoannouCoder/dfs-bfs/blob/main/Ioannou_Georgios_dfs.ipynb) and [Breadth First Search (BFS)](https://github.com/GeorgiosIoannouCoder/dfs-bfs/blob/main/Ioannou_Georgios_bfs.ipynb)\n3. The two notebooks above were coded having in mind the [problem statement mentioned in the introduction](https://github.com/GeorgiosIoannouCoder/dfs-bfs#problem-statement).\n\n## Reports\n\n1. You can find the first report for this project [here](https://github.com/GeorgiosIoannouCoder/dfs-bfs/blob/main/Ioannou_Georgios_Report_HW_2-1.pdf) where it shows step by step how Depth First Search (DFS) and Breadth First Search (BFS) work to find the goal cell.\n2. You can find the second report for this project [here](https://github.com/GeorgiosIoannouCoder/dfs-bfs/blob/main/Ioannou_Georgios_Report_HW_2-2.pdf) where it shows the time and space complexity of both Depth First Search (DFS) and Breadth First Search (BFS).\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to top\u003c/a\u003e\u003c/p\u003e\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\".\nDon't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to top\u003c/a\u003e\u003c/p\u003e\n\n## License\n\nDistributed under the MIT License. See [LICENSE](https://github.com/GeorgiosIoannouCoder/dfs-bfs/blob/main/LICENSE) for more information.\n\nMIT License\n\nCopyright (c) 2023 Georgios Ioannou\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to top\u003c/a\u003e\u003c/p\u003e\n\n## Contact\n\nGeorgios Ioannou - [@LinkedIn](https://linkedin.com/in/georgiosioannoucoder)\n\nGeorgios Ioannou - [@georgiosioannoucoder](https://georgiosioannoucoder.github.io/) - Please contact me via the form in my portfolio.\n\nProject Link: [https://github.com/GeorgiosIoannouCoder/dfs-bfs](https://github.com/GeorgiosIoannouCoder/dfs-bfs)\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to top\u003c/a\u003e\u003c/p\u003e\n\n[contributors-shield]: https://img.shields.io/github/contributors/GeorgiosIoannouCoder/dfs-bfs.svg?style=for-the-badge\n[contributors-url]: https://github.com/GeorgiosIoannouCoder/dfs-bfs/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/GeorgiosIoannouCoder/dfs-bfs.svg?style=for-the-badge\n[forks-url]: https://github.com/GeorgiosIoannouCoder/dfs-bfs/network/members\n[stars-shield]: https://img.shields.io/github/stars/GeorgiosIoannouCoder/dfs-bfs.svg?style=for-the-badge\n[stars-url]: https://github.com/GeorgiosIoannouCoder/dfs-bfs/stargazers\n[issues-shield]: https://img.shields.io/github/issues/GeorgiosIoannouCoder/dfs-bfs.svg?style=for-the-badge\n[issues-url]: https://github.com/GeorgiosIoannouCoder/dfs-bfs/issues\n[license-shield]: https://img.shields.io/github/license/GeorgiosIoannouCoder/dfs-bfs.svg?style=for-the-badge\n[license-url]: https://github.com/GeorgiosIoannouCoder/dfs-bfs/blob/main/LICENSE\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge\u0026logo=linkedin\u0026colorB=0077B5\n[linkedin-url]: https://linkedin.com/in/georgiosioannoucoder\n[github-shield]: https://img.shields.io/badge/-GitHub-black.svg?style=for-the-badge\u0026logo=github\u0026colorB=000\n[github-url]: https://github.com/GeorgiosIoannouCoder/\n[project-screenshot]: dfs-bfs.png\n[Python]: https://img.shields.io/badge/python-FFDE57?style=for-the-badge\u0026logo=python\u0026logoColor=4584B6\n[Python-url]: https://www.python.org/\n[JupyterNotebook]: https://img.shields.io/badge/jupyter-808080?style=for-the-badge\u0026logo=jupyter\u0026logoColor=FFA500\n[JupyterNotebook-url]: https://jupyter.org/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgiosioannoucoder%2Fdfs-bfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorgiosioannoucoder%2Fdfs-bfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorgiosioannoucoder%2Fdfs-bfs/lists"}