ARYA-BHARDWAJ / DFS-BFS-Sim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tree Traversal Visualization

made-with-python

Visualization of DFS and BFS using PyOpenGL and Pygame

Build

Run pip3 install to download modules.

python3 main.py to run program.

Topic

Graph Traversal

Domain/Subject

Graph Theory

Concept

DFS & BFS Algorithms

Abstract

Our project aims at simulating graph traversal techniques using BFS and DFS algorithms.

  1. The DFS algorithm works as follows:

    • a. Start by putting any one of the graph's vertices on top of a stack.
    • b. Take the top item of the stack and add it to the visited list.
    • c. Create a list of that vertex's adjacent nodes. Add the ones which aren't in the visited list to the top of stack.
    • d. Keep repeating steps 2 and 3 until the stack is empty.
  2. The BFS algorithm works as follows:

    • a. Start by putting any one of the graph's vertices at the back of a queue.
    • b. Take the front item of the queue and add it to the visited list.
    • c. Create a list of that vertex's adjacent nodes. Add the ones which aren't in the visited list to the back of the queue.
    • d. Keep repeating steps 2 and 3 until the queue is empty.

ForTheBadge built-with-love ForTheBadge winter-is-coming


About


Languages

Language:Python 100.0%