Welcome to seealgo’s documentation!¶
seealgo is a Python library designed to help you visualize a data structure as it changes throughout a function.
So far, the seealgo library provides visualization for the following data structures and methods:
- List:
append(value)
,insert(index, value)
,remove(value)
,__setitem__(index, value)
- Binary Search Tree (provided as a nested dictionary):
insert(child)
,remove(value)
- Set:
add(value)
,remove(value)
,clear()
,update(values)
- Dictionary (nested and non-nested)
update(iterable)
,pop(key)
:
Installation¶
This library requires you to have graphviz installed on your system using the instructions appropriate for your system, or by using the following command if you are on a macOS device:
brew install graphviz
Then, install seealgo using the following command:
pip install seealgo
Using seealgo¶
The following is an example of using the seealgo library to visualize appending a value to a list.
from seealgo import List
visual_list = List()
test_list = [1, 2, 3, 4]
def append_to_list(input_list):
input_list.append(5)
return input_list
visual_list.see(append_to_list, test_list)


The following is an example of using the seealgo library to visualize adding a leaf node to a binary search tree.
from seealgo import Tree
visual_tree = Tree()
test_tree = {
'8': {
'3': {
'1': null,
'6': null
},
'10': null
}
}
def insert_func(init_tree):
init_tree.add_child(2)
return init_tree
visual_tree.see(insert_func, test_tree)


The following is an example of using the seealgo library to visualize adding a new value to a set.
from seealgo import Set
visual_set = Set()
test_set = {7, 71, 227}
def add_func(user_set):
user_set.add(353)
return user_set
visual_set.see(add_func, test_set)


The following is an example of using the seealgo library to visualize adding new key-value pairs to a dictionary.
from seealgo import Dict
visual_dict = Dict()
test_dict_head = {'1': 1, '2': 4, '3': 9, '4': 16}
test_dict_tail = {'5': 25, '6': 36, '7': 49}
def update_func(user_dict):
user_dict.update(test_dict_tail)
return user_dict
visual_dict.see(update_func, test_dict_head)


Documentation: