hasnainroopawalla / Algorithm-Visualization-Python3

Draw Graphs and Visualize Algorithms (Sorting, Shortest Path, etc,) in Python3 (Pygame)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Algorithm Visualization Python3

Draw Graphs and Visualize Algorithms (Python3)

Built using the Pygame Library

pip install pygame

Graph Traversal

'ADD' button adds a new node to the canvas

Press 's' while cursor is on a node to define it as the source

Press 'd' while cursor is on a node to define it as the destination

Press 'l' while cursor is on a node to initialize a node link. Press 'l' again on another node to complete the link

Press 'Enter' to calculate Path from source to destination

Press 'space' to print the current graph

Path will be drawn using red color

Breadth First Search:

Breadth First Search

Depth First Search:

Depth First Search

Sorting

  • Insertion Sort
  • Bubble Sort
  • Heap Sort
  • Counting Sort
  • Cocktail Shaker Sort
  • Merge Sort
  • Shell Sort
  • Selection Sort
  • Quick Sort

Execute run.py from every folder

Press 'space' to shuffle the list

Press 'Enter' to begin sorting

Modify the 'NUMBER_OF_ELEMENTS' variable in run.py to increase/decrease the number of elements

Insertion Sort:

Insertion Sort

Bubble Sort:

Bubble Sort

About

Draw Graphs and Visualize Algorithms (Sorting, Shortest Path, etc,) in Python3 (Pygame)


Languages

Language:Python 100.0%