Data Structures and Algorithms Visualizer-AlgoWiz

Data Structures and Algorithms Visualizer-AlgoWiz


Data Structures and Algorithms are two of the core Computer Science Subjects. Data Structures, as its name suggests deals with storing the data in the most efficient manner- both with respect to Space and Time Complexities. Algorithms, on the other hand, provide a step-by-step process to execute commands/instructions to achieve the desired output. From a Computer Science's perspective, any program has the following timeline:  
'INPUT' -> 'PROCESS' -> 'OUTPUT'

It is relatively easier for us to be aware of the 'INPUT' we provide to the program, and the 'OUTPUT' we receive from it, compared to the PROCESS part of the program. It can be a challenging experience for anyone who is trying to implement the 'PROCESS' through complex data structures and algorithms. Visualization of such concepts proves to really enhance our understanding and learning experience, by aiding us to see our code in action. This is the basis of my application: 

AlgoWiz - 'Enhancing the understanding of complex Data Structures and Algorithms through Visualization'.

AlgoWiz is a Multi-Platform Application that allows users to Visualize various Data Structures and  Algorithms. It has a user-friendly GUI, optimized to visualize algorithms execution on Random Trees/Graphs, for users with little or no experience, and Custom, more Complex Data Structures for intermediate and more experienced users.
For building auto-generated Trees and Graphs, users can input the Number of Nodes and Create the Data Structure as follows:

fig.1 Auto-Generated Tree based on the Number of Nodes

fig.2 Auto-Generated Graph based on the Number of Nodes

This includes implementation of the Data Structures including:

  • Singly Linked Lists: Fundamental uni-directional, linear way of storing data.
fig.3 Singly Linked List

  • Doubly Linked Lists: Bi-directional, Linear Way of Storing data.
fig.4 Doubly Linked List

  • Stacks: First In, First Out Data Structure.
fig.5 Stack

  • Queues: First In, Last out Data Structure.
fig.6 Queue

  • Trees: AlgoWiz includes Binary Tree(Binary Tree), Complete BT, Full BT, etc.
fig.7  Binary Tree

  • Graphs: The application allows us to generate a Simple Graph, Multi-Graph, Pseudo-Graph, and Weighted Graph.
fig.8 Weighted Graph

The Algorithms included in the Application are:

  • In-order, Pre-order, Post-order, and Level-order Traversals: These algorithms help traverse through a tree, more specifically a Binary Tree. The basic structure of a Binary Tree node comprises of a Value, Pointer to the Right Child and, a Pointer to the Left Child.
class Node():
    Node __init__(self, Val):
        self.right=None
        self.value=Val
        self.left=None


    • The in-order sequence of traversal follows : Left-> Root-> Right
fig.9 In-Order Traversal

    • The pre-order sequence of traversal follows : Left-> Right-> Root
fig.10 Pre-order Traversal


    • The post-order sequence of traversal follows: Root-> Left-> Right
fig.11 Post-order Traversal

    • The Level order sequence of traversal follows: All the nodes in Level 0, 1, 2...,n
fig.12 Level-Order Traversal


                       Following is the example from the application that visualizes Traversal:
fig.13 Level-order Traversal Visualization in AlgoWiz



  • Breadth-First Search and Depth-First Search:  
          The Breadth-First Search Algorithm grows wide, layer-wise. BFS recursively looks for the element starting from the source to the neighbors in the first layer, then all the neighbors of the second layer, and so on. Below is the representation of this algorithm in a Weighted Graph Data Structure.

fig.14 Breadth-First Search of a Weighted Graph that searches 5

The Depth-First Search Algorithm, on the other hand, grows deep. DFS recursively looks for the element starting from the source to its neighbors, then the neighbor's neighbor, and so on.

fig.15 Depth-First Search of a Weighted Graph that searches 5

  • Djikstra's Shortest Path:
Djikstra's Shortest Path Algorithm finds the minimum weighted path between 2 nodes in a Weighted Graph.
fig.16 Shortest Path Algorithm


  • Prim's and Kruskal's Minimum Spanning Tree:
A Spanning Tree is a data structure formed from a weighted Graph by including all of its vertices, that are connected without forming a Cycle. There could be many Spanning Trees of a Graph. A Minimum Spanning Tree is one where the sum of the weights of the tree's edges is the least amongst all the spanning trees of the Graph. Given a weighted Graph, there are two main algorithms to find its Minimum Spanning Tree: Prim's and Kruskal's MST Algorithm. AlgoWiz comprises of visualization for both of these algorithms.

Prim's Algorithm:
fig.17 Prim's Algorithms to find Minimum Spanning Tree of the Graph
Kruskal's Algorithm:
  • fig.18 Kruskal's Algorithms to find Minimum Spanning Tree of the Graph

Technologies used in the Application

The Application makes use of Python(specifically Python 3.7) programming language with the following libraries:
  • Tkinter: For the GUI Framework
  • Matplotlib, Pylab, and Networkx for Graphs and Plotting
  • IDLE: Jupyter Notebook, Visual Studio, and Visual Studio Code
  • PyInstaller for Packaging the python files together
  • Agile Methodology- Scrum and Task Boards for Project Management
  • Additional Project Management Tools: Todoist and Trello
The Animation and Graph Integration was done through a custom-developed Algorithm with basic in-built python syntax. 

Future Works

All the above data structures and algorithms in the current version of the application work well. The upcoming iterations of the applications would include more advanced data structures such as Segment Trees, Red-Black Trees, Heap and algorithms for Searching, Multipath Finding, Scheduling Problems, Finding the Perfect Match, etc.
Latency in Python programs has been a well-known limitation. This could be seen while unpacking the application, switching between windows. This is a limitation of PyInstaller. I tried using Py2exe for packaging. It showed somewhat similar results.

Finally, you can find the project in my Github Repository linked here. Thanks for checking out my project. I would love to hear your thoughts or any feedback on the application. You can also reach me through my email-id: akshatbajpai.biz@gmail.com