Skip to main content

Tools for learning about algorithms and data structures

Project description


A collection of useful tools for students taking an introductory course in algorithms and data structures.


pip install algoaid


  • Time complexity analysis of functions
  • Graphs
    • Represent: [weighted] [un]directed, disjoint-set/union find
    • Easy to input a graph
    • Run basic graph algorithms (DFS, BFS, MST, Dijkstra's and more)
    • Visualise results
  • Versatile Min/Max-heap with decrease/increase key functionality


  • Time complexity: analyse
  • Graph class: Graph
  • Priority queues: MinHeap, MaxHeap

Usage: Time Complexity Analysis

Analyse time complexity of a function with a single parameter:

1. Import

from algoaid import analyse

2. Define a Function

def f(n):
    j = 1
    while j * j < n:
        j += 1

3. Analyse


Example Result

Usage: Graphs

Construct various types of graphs and run a selection of popular graph algorithms:

1. Import

from algoaid import Graph

2. Declare the Graph (each line represents an edge)

edges = """
    0..2 6
    0..1 1
    0..5 2
    2..5 4


  • Undirected: [node1]..[node2] [weight (optional)]
  • Directed: [from]..[to] [weight (optional)]
  • Disjoint-set: [parent]..[child]

3. Construct the Graph

# construct undirected graph
g = Graph(edges, type=Graph.GraphType.GRAPH)

# construct directed graph
g = Graph(edges, type=Graph.GraphType.DI_GRAPH)

# construct disjoint set
g = Graph(edges, type=Graph.GraphType.DISJOINT_SET)

4. Display the Graph

g.display("My Graph")

5. Run Algorithms

# Run DFS from node 0

# Run BFS from node 0

# Compute MST (requires a weighted undirected graph)

# Run Dijkstra's algorithm from node 0 (requires a weighted graph)

# Topological sorting (requires a directed graph)

# Find with path compression (requires disjoint-set)

# Union (requires disjoint-set)
g.show_union("9", "11")

Example Results

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algoaid-1.0.2.tar.gz (8.3 kB view hashes)

Uploaded source

Built Distribution

algoaid-1.0.2-py3-none-any.whl (8.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page