Set module¶
This module contains the functionality to visualize a set data structure as it changes throughout a function.
This involves the following classes:
TrackedSet(set): detects changes made to a given set data structure and triggers creation of a new visualization for each change.
Set: uses graphviz to construct a visualization of a set.
- class seealgo.see_set_algo.Set¶
Create graphviz visualization for set data structure
- create_viz(data, value=None)¶
Creates and renders a visualization of the set using graphviz
- Args:
data (set): set that is being visualized value (Any): optional value to highlight in the visualization
- see(func, data)¶
Creates a visualization for the initial set and starts tracking a given set as it changes throughout a given function.
- Args:
func (function): function that the set is being altered through data (set): set to track
- class seealgo.see_set_algo.TrackedSet¶
Tracks changes to a set data structure and triggers creation of new visualization
- Args:
set: the set data structure to track
- add(value)¶
Adds an element to the set and invokes a new visualization
- Args:
value (Any): element to be added to the set
- clear()¶
Clears the set and invokes a new visualization
- remove(value)¶
Removes an element from the set and invokes a new visualization
- Args:
value (Any): element to be removed from the set
- Raises:
KeyError: If the element to be removed is not in the set.
- update(values)¶
Adds multiple elements to the set and invokes a new visualization
- Args:
values (iterable): iterable of elements to be added to the set