Skip to main content

A Python library to visualize a data structure as it changes throughout a function

Project description

seealgo

A Python library to visualize a data structure as it changes throughout a function

CI PyPI Docs

Overview

When writing algorithms, I often find that visualizing the data structures are necessary, but it can be difficult and time-consuming to do so. The goal of the seealgo library is to allow users to visualize a given data structure as it changes in a given 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

(for examples of all data structures available with seealgo, visit our GitHub Pages!)

This is an example of using the List module to visualize appending 5 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)

This is an example of using the Tree module to visualize adding a leaf node with value 2 to a binary search tree:

from seealgo import Tree

visual_tree = Tree()

test_tree = {
    '8': {
        '3': {
            '1': None,
            '6': None
        },
        '10': None
    }
}

def insert_func(init_tree):
    init_tree.add_child(2)
    return init_tree

visual_tree.see(insert_func, test_tree)

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

seealgo-0.2.0.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

seealgo-0.2.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file seealgo-0.2.0.tar.gz.

File metadata

  • Download URL: seealgo-0.2.0.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for seealgo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8c48b1764844de437567f651929b9503b83822d4fd9fb7ddf417b7b510389039
MD5 b8adfad44201474e7d92c7328cd35bac
BLAKE2b-256 7873669ad28307326b879495d47ae2f3cc8c2a65d64269b1d231fa23949c2301

See more details on using hashes here.

File details

Details for the file seealgo-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: seealgo-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for seealgo-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7aee7f52c9f05654ce242ed82188c83cd84eed5651f7517b45a7d73a0e6cce2f
MD5 7618ff2e812b805c83e00f2db335e127
BLAKE2b-256 fd22bbc381e4f2a78b328124c073bd03f6be083a9bdb45ae663d15fcc59f8e2d

See more details on using hashes here.

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