List module

This module contains the functionality to visualize a list data structure as it changes throughout a function.

This involves the following classes:

  • TrackedArray(list): detects changes made to a given list data structure and triggers creation of a new visualization for each change.

  • List: uses graphviz to construct a node-edge visualization of a list.

class seealgo.see_list_algo.List

Create graphviz visualization for list data structure

create_viz(data, index)

Creates and renders a visualization of the list using graphviz

Args:

data (list): list that is being visualized index (int): index of the element that has been changed

see(func, data)

Creates a visualization for the initial list and starts tracking a given list as it changes throughout a given function.

Args:

func (function): function that the list is being altered through data (list): list to track

class seealgo.see_list_algo.TrackedArray(*args, **kwargs)

Tracks changes to a list data structure and triggers creation of new visualization

Args:

list: the list data structure to track

append(value)

Appends an element to the end of the list and checks the length of the list

Args:

value (Any): element to be appended to the list

check_length(index, invoke)

Checks for change in the length of the list and triggers creation of a new visualization if the list length has changed.

Args:

index (int): index of the element that has changed invoke (boolean): indicates whether the visualization should be created

insert(index, value)

Inserts an element at a specified position and checks the length of the list

Args:

index (int >= 0): position at which the element is to be inserted value (Any): value of element to be inserted at the specified index

remove(value)

Removes the first occurrence of a value from the list and checks the length of the list

Args:

value (Any): value to be removed from the list