memory-graph 0.3.26__tar.gz → 0.3.27__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {memory_graph-0.3.26/memory_graph.egg-info → memory_graph-0.3.27}/PKG-INFO +15 -15
- {memory_graph-0.3.26 → memory_graph-0.3.27}/README.md +14 -14
- memory_graph-0.3.27/images/cmp.sh +3 -0
- memory_graph-0.3.27/images/cmp.sh~ +1 -0
- memory_graph-0.3.27/images/debugging01.png +0 -0
- memory_graph-0.3.27/images/debugging02.png +0 -0
- memory_graph-0.3.27/images/debugging03.png +0 -0
- memory_graph-0.3.27/images/debugging04.png +0 -0
- memory_graph-0.3.27/images/debugging05.png +0 -0
- memory_graph-0.3.27/images/debugging06.png +0 -0
- memory_graph-0.3.27/images/factorial01.png +0 -0
- memory_graph-0.3.27/images/factorial02.png +0 -0
- memory_graph-0.3.27/images/factorial03.png +0 -0
- memory_graph-0.3.27/images/factorial04.png +0 -0
- memory_graph-0.3.27/images/factorial05.png +0 -0
- memory_graph-0.3.27/images/factorial06.png +0 -0
- memory_graph-0.3.27/images/factorial07.png +0 -0
- memory_graph-0.3.27/images/linked_list.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/linked_list.py +12 -12
- memory_graph-0.3.27/images/name_rebinding.py~ +7 -0
- memory_graph-0.3.27/images/power_set1.png +0 -0
- memory_graph-0.3.27/images/power_set10.png +0 -0
- memory_graph-0.3.27/images/power_set11.png +0 -0
- memory_graph-0.3.27/images/power_set12.png +0 -0
- memory_graph-0.3.27/images/power_set13.png +0 -0
- memory_graph-0.3.27/images/power_set14.png +0 -0
- memory_graph-0.3.27/images/power_set15.png +0 -0
- memory_graph-0.3.27/images/power_set16.png +0 -0
- memory_graph-0.3.27/images/power_set17.png +0 -0
- memory_graph-0.3.27/images/power_set18.png +0 -0
- memory_graph-0.3.27/images/power_set19.png +0 -0
- memory_graph-0.3.27/images/power_set2.png +0 -0
- memory_graph-0.3.27/images/power_set20.png +0 -0
- memory_graph-0.3.27/images/power_set21.png +0 -0
- memory_graph-0.3.27/images/power_set22.png +0 -0
- memory_graph-0.3.27/images/power_set3.png +0 -0
- memory_graph-0.3.27/images/power_set4.png +0 -0
- memory_graph-0.3.27/images/power_set5.png +0 -0
- memory_graph-0.3.27/images/power_set6.png +0 -0
- memory_graph-0.3.27/images/power_set7.png +0 -0
- memory_graph-0.3.27/images/power_set8.png +0 -0
- memory_graph-0.3.27/images/power_set9.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/__init__.py +11 -9
- memory_graph-0.3.27/memory_graph/t.py +6 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27/memory_graph.egg-info}/PKG-INFO +15 -15
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph.egg-info/SOURCES.txt +12 -101
- {memory_graph-0.3.26 → memory_graph-0.3.27}/setup.py +1 -1
- memory_graph-0.3.26/images/.ipynb_checkpoints/jupyter_example-checkpoint.ipynb +0 -85
- memory_graph-0.3.26/images/add_one.gv +0 -69
- memory_graph-0.3.26/images/avltree.py~ +0 -41
- memory_graph-0.3.26/images/avltree_dir.gv +0 -55
- memory_graph-0.3.26/images/avltree_fail.gv +0 -22
- memory_graph-0.3.26/images/avltree_key_value.gv +0 -49
- memory_graph-0.3.26/images/avltree_leaf.gv +0 -22
- memory_graph-0.3.26/images/avltree_linear.gv +0 -57
- memory_graph-0.3.26/images/avltree_table.gv +0 -49
- memory_graph-0.3.26/images/bin_tree.gv +0 -110
- memory_graph-0.3.26/images/bin_tree2.py +0 -31
- memory_graph-0.3.26/images/bin_tree2.py~ +0 -31
- memory_graph-0.3.26/images/copies.gv +0 -63
- memory_graph-0.3.26/images/copy_method.gv +0 -53
- memory_graph-0.3.26/images/debugging01.gv +0 -29
- memory_graph-0.3.26/images/debugging01.png +0 -0
- memory_graph-0.3.26/images/debugging02.gv +0 -38
- memory_graph-0.3.26/images/debugging02.png +0 -0
- memory_graph-0.3.26/images/debugging03.gv +0 -47
- memory_graph-0.3.26/images/debugging03.png +0 -0
- memory_graph-0.3.26/images/debugging04.gv +0 -57
- memory_graph-0.3.26/images/debugging04.png +0 -0
- memory_graph-0.3.26/images/debugging05.gv +0 -68
- memory_graph-0.3.26/images/debugging05.png +0 -0
- memory_graph-0.3.26/images/debugging06.gv +0 -68
- memory_graph-0.3.26/images/debugging06.png +0 -0
- memory_graph-0.3.26/images/depth.gv +0 -178
- memory_graph-0.3.26/images/depth.png +0 -0
- memory_graph-0.3.26/images/extension_numpy.gv +0 -52
- memory_graph-0.3.26/images/extension_pandas.gv +0 -49
- memory_graph-0.3.26/images/factorial0.gv +0 -15
- memory_graph-0.3.26/images/factorial0.png +0 -0
- memory_graph-0.3.26/images/factorial01.gv +0 -15
- memory_graph-0.3.26/images/factorial02.gv +0 -22
- memory_graph-0.3.26/images/factorial03.gv +0 -28
- memory_graph-0.3.26/images/factorial04.gv +0 -34
- memory_graph-0.3.26/images/factorial05.gv +0 -35
- memory_graph-0.3.26/images/factorial06.gv +0 -29
- memory_graph-0.3.26/images/factorial07.gv +0 -23
- memory_graph-0.3.26/images/factorial1.gv +0 -22
- memory_graph-0.3.26/images/factorial1.png +0 -0
- memory_graph-0.3.26/images/factorial2.gv +0 -28
- memory_graph-0.3.26/images/factorial2.png +0 -0
- memory_graph-0.3.26/images/factorial3.gv +0 -34
- memory_graph-0.3.26/images/factorial3.png +0 -0
- memory_graph-0.3.26/images/factorial4.gv +0 -35
- memory_graph-0.3.26/images/factorial4.png +0 -0
- memory_graph-0.3.26/images/factorial5.gv +0 -29
- memory_graph-0.3.26/images/factorial5.png +0 -0
- memory_graph-0.3.26/images/factorial6.gv +0 -23
- memory_graph-0.3.26/images/factorial6.png +0 -0
- memory_graph-0.3.26/images/hash_set.gv +0 -96
- memory_graph-0.3.26/images/hidden_edges.gv +0 -37
- memory_graph-0.3.26/images/hidden_edges.py +0 -8
- memory_graph-0.3.26/images/hidden_edges.py~ +0 -9
- memory_graph-0.3.26/images/highlight.gv +0 -92
- memory_graph-0.3.26/images/immutable1.gv +0 -18
- memory_graph-0.3.26/images/immutable2.gv +0 -27
- memory_graph-0.3.26/images/introspect_depth.gv +0 -178
- memory_graph-0.3.26/images/introspect_depth.py~ +0 -26
- memory_graph-0.3.26/images/linked_list.gv +0 -55
- memory_graph-0.3.26/images/linked_list.png +0 -0
- memory_graph-0.3.26/images/log.txt +0 -186
- memory_graph-0.3.26/images/many_types.gv +0 -46
- memory_graph-0.3.26/images/memory_graph.gv +0 -70
- memory_graph-0.3.26/images/memory_graph.gv.pdf +0 -0
- memory_graph-0.3.26/images/memory_graph.pdf +0 -0
- memory_graph-0.3.26/images/mutable1.gv +0 -18
- memory_graph-0.3.26/images/mutable2.gv +0 -19
- memory_graph-0.3.26/images/my_graph.gv +0 -31
- memory_graph-0.3.26/images/my_graph.pdf +0 -0
- memory_graph-0.3.26/images/not_node_types.py~ +0 -9
- memory_graph-0.3.26/images/not_node_types1.gv +0 -26
- memory_graph-0.3.26/images/not_node_types2.gv +0 -46
- memory_graph-0.3.26/images/power_set0.gv +0 -38
- memory_graph-0.3.26/images/power_set0.png +0 -0
- memory_graph-0.3.26/images/power_set1.gv +0 -53
- memory_graph-0.3.26/images/power_set1.png +0 -0
- memory_graph-0.3.26/images/power_set10.gv +0 -103
- memory_graph-0.3.26/images/power_set10.png +0 -0
- memory_graph-0.3.26/images/power_set11.gv +0 -93
- memory_graph-0.3.26/images/power_set11.png +0 -0
- memory_graph-0.3.26/images/power_set12.gv +0 -93
- memory_graph-0.3.26/images/power_set12.png +0 -0
- memory_graph-0.3.26/images/power_set13.gv +0 -103
- memory_graph-0.3.26/images/power_set13.png +0 -0
- memory_graph-0.3.26/images/power_set14.gv +0 -114
- memory_graph-0.3.26/images/power_set14.png +0 -0
- memory_graph-0.3.26/images/power_set15.gv +0 -120
- memory_graph-0.3.26/images/power_set15.png +0 -0
- memory_graph-0.3.26/images/power_set16.gv +0 -116
- memory_graph-0.3.26/images/power_set16.png +0 -0
- memory_graph-0.3.26/images/power_set17.gv +0 -116
- memory_graph-0.3.26/images/power_set17.png +0 -0
- memory_graph-0.3.26/images/power_set18.gv +0 -126
- memory_graph-0.3.26/images/power_set18.png +0 -0
- memory_graph-0.3.26/images/power_set19.gv +0 -132
- memory_graph-0.3.26/images/power_set19.png +0 -0
- memory_graph-0.3.26/images/power_set2.gv +0 -63
- memory_graph-0.3.26/images/power_set2.png +0 -0
- memory_graph-0.3.26/images/power_set20.gv +0 -128
- memory_graph-0.3.26/images/power_set20.png +0 -0
- memory_graph-0.3.26/images/power_set21.gv +0 -118
- memory_graph-0.3.26/images/power_set21.png +0 -0
- memory_graph-0.3.26/images/power_set22.gv +0 -108
- memory_graph-0.3.26/images/power_set22.png +0 -0
- memory_graph-0.3.26/images/power_set23.gv +0 -93
- memory_graph-0.3.26/images/power_set23.png +0 -0
- memory_graph-0.3.26/images/power_set3.gv +0 -74
- memory_graph-0.3.26/images/power_set3.png +0 -0
- memory_graph-0.3.26/images/power_set4.gv +0 -85
- memory_graph-0.3.26/images/power_set4.png +0 -0
- memory_graph-0.3.26/images/power_set5.gv +0 -93
- memory_graph-0.3.26/images/power_set5.png +0 -0
- memory_graph-0.3.26/images/power_set6.gv +0 -91
- memory_graph-0.3.26/images/power_set6.png +0 -0
- memory_graph-0.3.26/images/power_set7.gv +0 -90
- memory_graph-0.3.26/images/power_set7.png +0 -0
- memory_graph-0.3.26/images/power_set8.gv +0 -101
- memory_graph-0.3.26/images/power_set8.png +0 -0
- memory_graph-0.3.26/images/power_set9.gv +0 -107
- memory_graph-0.3.26/images/power_set9.png +0 -0
- memory_graph-0.3.26/images/rebinding1.gv +0 -18
- memory_graph-0.3.26/images/rebinding2.gv +0 -26
- memory_graph-0.3.26/install.txt +0 -31
- memory_graph-0.3.26/src/auto_memory_graph.py +0 -21
- memory_graph-0.3.26/src/jupyter_example.ipynb +0 -85
- memory_graph-0.3.26/src/pyodide.html +0 -182
- memory_graph-0.3.26/uml/memory_graph.uxf +0 -322
- {memory_graph-0.3.26 → memory_graph-0.3.27}/LICENSE.txt +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/MANIFEST.in +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/add_one.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/add_one.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/avltree.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/avltree_dir.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/avltree_fail.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/avltree_key_value.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/avltree_leaf.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/avltree_linear.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/avltree_table.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/bin_tree.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/bin_tree.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/copies.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/copies.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/copy_method.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/copy_method.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/create_gif.sh +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/create_images.sh +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/debug_vscode.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/debugging.gif +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/debugging.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/extension_numpy.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/extension_numpy.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/extension_pandas.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/extension_pandas.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/factorial.gif +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/factorial.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/hash_set.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/hash_set.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/hidden_edges.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/highlight.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/highlight.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/immutable.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/immutable1.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/immutable2.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/introspect_depth.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/introspect_depth.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/ipython.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/jupyter_example.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/many_types.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/many_types.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/mutable.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/mutable1.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/mutable2.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/name_rebinding.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/not_node_types.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/not_node_types1.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/not_node_types2.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/power_set.gif +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/power_set.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/pyodide.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/rebinding1.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/rebinding2.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/uva.png +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/images/vscode_copying.gif +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/call_stack.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/config.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/config_default.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/config_helpers.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/extension_numpy.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/extension_pandas.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/html_table.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/list_view.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/memory_to_nodes.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/node_base.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/node_key_value.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/node_leaf.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/node_linear.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/node_table.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/sequence.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/slicer.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/slices.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/slices_iterator.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/slices_table_iterator.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/test.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/test_max_graph_depth.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/test_memory_graph.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/test_memory_to_nodes.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/test_sequence.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/test_slicer.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/test_slices.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/test_slices_iterator.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph/utils.py +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph.egg-info/dependency_links.txt +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph.egg-info/requires.txt +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/memory_graph.egg-info/top_level.txt +0 -0
- {memory_graph-0.3.26 → memory_graph-0.3.27}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.27
|
|
4
4
|
Summary: Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy.
|
|
5
5
|
Home-page: https://github.com/bterwijn/memory_graph
|
|
6
6
|
Author: Bas Terwijn
|
|
@@ -410,37 +410,37 @@ and pressing <Enter> a number of times, results in:
|
|
|
410
410
|
# Data Structure Examples #
|
|
411
411
|
Module memory_graph can be very useful in a course about data structures, some examples:
|
|
412
412
|
|
|
413
|
-
## Doubly Linked List ##
|
|
413
|
+
## Circular Doubly Linked List ##
|
|
414
414
|
```python
|
|
415
415
|
import memory_graph as mg
|
|
416
416
|
import random
|
|
417
417
|
random.seed(0) # use same random numbers each run
|
|
418
418
|
|
|
419
419
|
class Linked_List:
|
|
420
|
+
""" Circular doubly linked list """
|
|
420
421
|
|
|
421
|
-
def __init__(self, value=None,
|
|
422
|
-
|
|
422
|
+
def __init__(self, value=None,
|
|
423
|
+
prev=None, next=None):
|
|
424
|
+
self.prev = prev if prev else self
|
|
423
425
|
self.value = value
|
|
424
|
-
self.next = next
|
|
426
|
+
self.next = next if next else self
|
|
425
427
|
|
|
426
|
-
def
|
|
428
|
+
def add_back(self, value):
|
|
427
429
|
if self.value == None:
|
|
428
430
|
self.value = value
|
|
429
|
-
elif self.next is None:
|
|
430
|
-
new_node = Linked_List(value)
|
|
431
|
-
self.prev = new_node
|
|
432
|
-
self.next = new_node
|
|
433
431
|
else:
|
|
434
|
-
new_node = Linked_List(value,
|
|
435
|
-
|
|
436
|
-
|
|
432
|
+
new_node = Linked_List(value,
|
|
433
|
+
prev=self.prev,
|
|
434
|
+
next=self)
|
|
435
|
+
self.prev.next = new_node
|
|
436
|
+
self.prev = new_node
|
|
437
437
|
|
|
438
438
|
linked_list = Linked_List()
|
|
439
439
|
n = 100
|
|
440
440
|
for i in range(n):
|
|
441
441
|
value = random.randrange(n)
|
|
442
|
-
linked_list.
|
|
443
|
-
|
|
442
|
+
linked_list.add_back(value)
|
|
443
|
+
mg.block(mg.show, locals()) # <--- draw locals
|
|
444
444
|
```
|
|
445
445
|

|
|
446
446
|
|
|
@@ -391,37 +391,37 @@ and pressing <Enter> a number of times, results in:
|
|
|
391
391
|
# Data Structure Examples #
|
|
392
392
|
Module memory_graph can be very useful in a course about data structures, some examples:
|
|
393
393
|
|
|
394
|
-
## Doubly Linked List ##
|
|
394
|
+
## Circular Doubly Linked List ##
|
|
395
395
|
```python
|
|
396
396
|
import memory_graph as mg
|
|
397
397
|
import random
|
|
398
398
|
random.seed(0) # use same random numbers each run
|
|
399
399
|
|
|
400
400
|
class Linked_List:
|
|
401
|
+
""" Circular doubly linked list """
|
|
401
402
|
|
|
402
|
-
def __init__(self, value=None,
|
|
403
|
-
|
|
403
|
+
def __init__(self, value=None,
|
|
404
|
+
prev=None, next=None):
|
|
405
|
+
self.prev = prev if prev else self
|
|
404
406
|
self.value = value
|
|
405
|
-
self.next = next
|
|
407
|
+
self.next = next if next else self
|
|
406
408
|
|
|
407
|
-
def
|
|
409
|
+
def add_back(self, value):
|
|
408
410
|
if self.value == None:
|
|
409
411
|
self.value = value
|
|
410
|
-
elif self.next is None:
|
|
411
|
-
new_node = Linked_List(value)
|
|
412
|
-
self.prev = new_node
|
|
413
|
-
self.next = new_node
|
|
414
412
|
else:
|
|
415
|
-
new_node = Linked_List(value,
|
|
416
|
-
|
|
417
|
-
|
|
413
|
+
new_node = Linked_List(value,
|
|
414
|
+
prev=self.prev,
|
|
415
|
+
next=self)
|
|
416
|
+
self.prev.next = new_node
|
|
417
|
+
self.prev = new_node
|
|
418
418
|
|
|
419
419
|
linked_list = Linked_List()
|
|
420
420
|
n = 100
|
|
421
421
|
for i in range(n):
|
|
422
422
|
value = random.randrange(n)
|
|
423
|
-
linked_list.
|
|
424
|
-
|
|
423
|
+
linked_list.add_back(value)
|
|
424
|
+
mg.block(mg.show, locals()) # <--- draw locals
|
|
425
425
|
```
|
|
426
426
|

|
|
427
427
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
o $1 && sleep 0.3 && o ../images_old/$1
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,29 +7,29 @@ import random
|
|
|
7
7
|
random.seed(0) # use same random numbers each run
|
|
8
8
|
|
|
9
9
|
class Linked_List:
|
|
10
|
+
""" Circular doubly linked list """
|
|
10
11
|
|
|
11
|
-
def __init__(self, value=None,
|
|
12
|
-
|
|
12
|
+
def __init__(self, value=None,
|
|
13
|
+
prev=None, next=None):
|
|
14
|
+
self.prev = prev if prev else self
|
|
13
15
|
self.value = value
|
|
14
|
-
self.next = next
|
|
16
|
+
self.next = next if next else self
|
|
15
17
|
|
|
16
|
-
def
|
|
18
|
+
def add_back(self, value):
|
|
17
19
|
if self.value == None:
|
|
18
20
|
self.value = value
|
|
19
|
-
elif self.next is None:
|
|
20
|
-
new_node = Linked_List(value)
|
|
21
|
-
self.prev = new_node
|
|
22
|
-
self.next = new_node
|
|
23
21
|
else:
|
|
24
|
-
new_node = Linked_List(value,
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
new_node = Linked_List(value,
|
|
23
|
+
prev=self.prev,
|
|
24
|
+
next=self)
|
|
25
|
+
self.prev.next = new_node
|
|
26
|
+
self.prev = new_node
|
|
27
27
|
|
|
28
28
|
linked_list = Linked_List()
|
|
29
29
|
n = 100
|
|
30
30
|
for i in range(n):
|
|
31
31
|
value = random.randrange(n)
|
|
32
|
-
linked_list.
|
|
32
|
+
linked_list.add_back(value)
|
|
33
33
|
if value == 33:
|
|
34
34
|
mg.render(locals(), "linked_list.png")
|
|
35
35
|
exit()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -10,11 +10,12 @@ import memory_graph.utils as utils
|
|
|
10
10
|
|
|
11
11
|
import inspect
|
|
12
12
|
import sys
|
|
13
|
+
import itertools as it
|
|
13
14
|
from memory_graph.call_stack import call_stack
|
|
14
15
|
|
|
15
16
|
import graphviz
|
|
16
17
|
|
|
17
|
-
__version__ = "0.3.
|
|
18
|
+
__version__ = "0.3.27"
|
|
18
19
|
__author__ = 'Bas Terwijn'
|
|
19
20
|
render_filename = 'memory_graph.pdf'
|
|
20
21
|
render_filename_count = 0
|
|
@@ -224,12 +225,13 @@ def get_call_stack(up_to_function="<module>",stack_index=0):
|
|
|
224
225
|
|
|
225
226
|
def stack_after_up_to(after_function,up_to_function="<module>"):
|
|
226
227
|
return get_call_stack_after_up_to(after_function, up_to_function)
|
|
227
|
-
def get_call_stack_after_up_to(after_function,up_to_function="<module>"):
|
|
228
|
-
""" Gets the call stack after the function 'after_function' up to the function 'up_to_function'
|
|
229
|
-
|
|
228
|
+
def get_call_stack_after_up_to(after_function,up_to_function="<module>", drop=0):
|
|
229
|
+
""" Gets the call stack after the function 'after_function' up to the function 'up_to_function'
|
|
230
|
+
and drop the first 'drop' stack frames. """
|
|
231
|
+
frames = reversed(list(it.islice(
|
|
230
232
|
utils.take_up_to(lambda i: i.function == up_to_function,
|
|
231
233
|
utils.take_after(lambda i: i.function == after_function, inspect.stack()))
|
|
232
|
-
))
|
|
234
|
+
, 1, None)))
|
|
233
235
|
return stack_frames_to_dict(frames)
|
|
234
236
|
|
|
235
237
|
def stack_pdb(after_function="trace_dispatch",up_to_function="<module>"):
|
|
@@ -244,11 +246,11 @@ def get_call_stack_vscode(after_function="do_wait_suspend",up_to_function="<modu
|
|
|
244
246
|
""" Get the call stack in a 'vscode' debugger session, filtering out the 'vscode' functions that polute the graph. """
|
|
245
247
|
return get_call_stack_after_up_to(after_function,up_to_function)
|
|
246
248
|
|
|
247
|
-
def stack_pycharm(after_function="
|
|
249
|
+
def stack_pycharm(after_function="do_wait_suspend",up_to_function="<module>"):
|
|
248
250
|
return get_call_stack_pycharm(after_function, up_to_function)
|
|
249
|
-
def get_call_stack_pycharm(after_function="
|
|
250
|
-
""" Get the call stack in a '
|
|
251
|
-
return get_call_stack_after_up_to(after_function,up_to_function)
|
|
251
|
+
def get_call_stack_pycharm(after_function="do_wait_suspend",up_to_function="<module>"):
|
|
252
|
+
""" Get the call stack in a 'vscode' debugger session, filtering out the 'vscode' functions that polute the graph. """
|
|
253
|
+
return get_call_stack_after_up_to(after_function,up_to_function, 1)
|
|
252
254
|
|
|
253
255
|
def save_call_stack(filename):
|
|
254
256
|
""" Saves the call stack to 'filename' for inspection to see what functions need to be
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.27
|
|
4
4
|
Summary: Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy.
|
|
5
5
|
Home-page: https://github.com/bterwijn/memory_graph
|
|
6
6
|
Author: Bas Terwijn
|
|
@@ -410,37 +410,37 @@ and pressing <Enter> a number of times, results in:
|
|
|
410
410
|
# Data Structure Examples #
|
|
411
411
|
Module memory_graph can be very useful in a course about data structures, some examples:
|
|
412
412
|
|
|
413
|
-
## Doubly Linked List ##
|
|
413
|
+
## Circular Doubly Linked List ##
|
|
414
414
|
```python
|
|
415
415
|
import memory_graph as mg
|
|
416
416
|
import random
|
|
417
417
|
random.seed(0) # use same random numbers each run
|
|
418
418
|
|
|
419
419
|
class Linked_List:
|
|
420
|
+
""" Circular doubly linked list """
|
|
420
421
|
|
|
421
|
-
def __init__(self, value=None,
|
|
422
|
-
|
|
422
|
+
def __init__(self, value=None,
|
|
423
|
+
prev=None, next=None):
|
|
424
|
+
self.prev = prev if prev else self
|
|
423
425
|
self.value = value
|
|
424
|
-
self.next = next
|
|
426
|
+
self.next = next if next else self
|
|
425
427
|
|
|
426
|
-
def
|
|
428
|
+
def add_back(self, value):
|
|
427
429
|
if self.value == None:
|
|
428
430
|
self.value = value
|
|
429
|
-
elif self.next is None:
|
|
430
|
-
new_node = Linked_List(value)
|
|
431
|
-
self.prev = new_node
|
|
432
|
-
self.next = new_node
|
|
433
431
|
else:
|
|
434
|
-
new_node = Linked_List(value,
|
|
435
|
-
|
|
436
|
-
|
|
432
|
+
new_node = Linked_List(value,
|
|
433
|
+
prev=self.prev,
|
|
434
|
+
next=self)
|
|
435
|
+
self.prev.next = new_node
|
|
436
|
+
self.prev = new_node
|
|
437
437
|
|
|
438
438
|
linked_list = Linked_List()
|
|
439
439
|
n = 100
|
|
440
440
|
for i in range(n):
|
|
441
441
|
value = random.randrange(n)
|
|
442
|
-
linked_list.
|
|
443
|
-
|
|
442
|
+
linked_list.add_back(value)
|
|
443
|
+
mg.block(mg.show, locals()) # <--- draw locals
|
|
444
444
|
```
|
|
445
445
|

|
|
446
446
|
|
|
@@ -1,34 +1,22 @@
|
|
|
1
1
|
LICENSE.txt
|
|
2
2
|
MANIFEST.in
|
|
3
3
|
README.md
|
|
4
|
-
install.txt
|
|
5
4
|
setup.py
|
|
6
|
-
images/add_one.gv
|
|
7
5
|
images/add_one.png
|
|
8
6
|
images/add_one.py
|
|
9
7
|
images/avltree.py
|
|
10
|
-
images/avltree.py~
|
|
11
|
-
images/avltree_dir.gv
|
|
12
8
|
images/avltree_dir.png
|
|
13
|
-
images/avltree_fail.gv
|
|
14
9
|
images/avltree_fail.png
|
|
15
|
-
images/avltree_key_value.gv
|
|
16
10
|
images/avltree_key_value.png
|
|
17
|
-
images/avltree_leaf.gv
|
|
18
11
|
images/avltree_leaf.png
|
|
19
|
-
images/avltree_linear.gv
|
|
20
12
|
images/avltree_linear.png
|
|
21
|
-
images/avltree_table.gv
|
|
22
13
|
images/avltree_table.png
|
|
23
|
-
images/bin_tree.gv
|
|
24
14
|
images/bin_tree.png
|
|
25
15
|
images/bin_tree.py
|
|
26
|
-
images/
|
|
27
|
-
images/
|
|
28
|
-
images/copies.gv
|
|
16
|
+
images/cmp.sh
|
|
17
|
+
images/cmp.sh~
|
|
29
18
|
images/copies.png
|
|
30
19
|
images/copies.py
|
|
31
|
-
images/copy_method.gv
|
|
32
20
|
images/copy_method.png
|
|
33
21
|
images/copy_method.py
|
|
34
22
|
images/create_gif.sh
|
|
@@ -36,152 +24,78 @@ images/create_images.sh
|
|
|
36
24
|
images/debug_vscode.png
|
|
37
25
|
images/debugging.gif
|
|
38
26
|
images/debugging.py
|
|
39
|
-
images/debugging01.gv
|
|
40
27
|
images/debugging01.png
|
|
41
|
-
images/debugging02.gv
|
|
42
28
|
images/debugging02.png
|
|
43
|
-
images/debugging03.gv
|
|
44
29
|
images/debugging03.png
|
|
45
|
-
images/debugging04.gv
|
|
46
30
|
images/debugging04.png
|
|
47
|
-
images/debugging05.gv
|
|
48
31
|
images/debugging05.png
|
|
49
|
-
images/debugging06.gv
|
|
50
32
|
images/debugging06.png
|
|
51
|
-
images/depth.gv
|
|
52
|
-
images/depth.png
|
|
53
|
-
images/extension_numpy.gv
|
|
54
33
|
images/extension_numpy.png
|
|
55
34
|
images/extension_numpy.py
|
|
56
|
-
images/extension_pandas.gv
|
|
57
35
|
images/extension_pandas.png
|
|
58
36
|
images/extension_pandas.py
|
|
59
37
|
images/factorial.gif
|
|
60
38
|
images/factorial.py
|
|
61
|
-
images/
|
|
62
|
-
images/
|
|
63
|
-
images/
|
|
64
|
-
images/
|
|
65
|
-
images/
|
|
66
|
-
images/
|
|
67
|
-
images/
|
|
68
|
-
images/factorial06.gv
|
|
69
|
-
images/factorial07.gv
|
|
70
|
-
images/factorial1.gv
|
|
71
|
-
images/factorial1.png
|
|
72
|
-
images/factorial2.gv
|
|
73
|
-
images/factorial2.png
|
|
74
|
-
images/factorial3.gv
|
|
75
|
-
images/factorial3.png
|
|
76
|
-
images/factorial4.gv
|
|
77
|
-
images/factorial4.png
|
|
78
|
-
images/factorial5.gv
|
|
79
|
-
images/factorial5.png
|
|
80
|
-
images/factorial6.gv
|
|
81
|
-
images/factorial6.png
|
|
82
|
-
images/hash_set.gv
|
|
39
|
+
images/factorial01.png
|
|
40
|
+
images/factorial02.png
|
|
41
|
+
images/factorial03.png
|
|
42
|
+
images/factorial04.png
|
|
43
|
+
images/factorial05.png
|
|
44
|
+
images/factorial06.png
|
|
45
|
+
images/factorial07.png
|
|
83
46
|
images/hash_set.png
|
|
84
47
|
images/hash_set.py
|
|
85
|
-
images/hidden_edges.gv
|
|
86
48
|
images/hidden_edges.png
|
|
87
|
-
images/hidden_edges.py
|
|
88
|
-
images/hidden_edges.py~
|
|
89
|
-
images/highlight.gv
|
|
90
49
|
images/highlight.png
|
|
91
50
|
images/highlight.py
|
|
92
51
|
images/immutable.py
|
|
93
|
-
images/immutable1.gv
|
|
94
52
|
images/immutable1.png
|
|
95
|
-
images/immutable2.gv
|
|
96
53
|
images/immutable2.png
|
|
97
|
-
images/introspect_depth.gv
|
|
98
54
|
images/introspect_depth.png
|
|
99
55
|
images/introspect_depth.py
|
|
100
|
-
images/introspect_depth.py~
|
|
101
56
|
images/ipython.png
|
|
102
57
|
images/jupyter_example.png
|
|
103
|
-
images/linked_list.gv
|
|
104
58
|
images/linked_list.png
|
|
105
59
|
images/linked_list.py
|
|
106
|
-
images/log.txt
|
|
107
|
-
images/many_types.gv
|
|
108
60
|
images/many_types.png
|
|
109
61
|
images/many_types.py
|
|
110
|
-
images/memory_graph.gv
|
|
111
|
-
images/memory_graph.gv.pdf
|
|
112
|
-
images/memory_graph.pdf
|
|
113
62
|
images/mutable.py
|
|
114
|
-
images/mutable1.gv
|
|
115
63
|
images/mutable1.png
|
|
116
|
-
images/mutable2.gv
|
|
117
64
|
images/mutable2.png
|
|
118
|
-
images/my_graph.gv
|
|
119
|
-
images/my_graph.pdf
|
|
120
65
|
images/name_rebinding.py
|
|
66
|
+
images/name_rebinding.py~
|
|
121
67
|
images/not_node_types.py
|
|
122
|
-
images/not_node_types.py~
|
|
123
|
-
images/not_node_types1.gv
|
|
124
68
|
images/not_node_types1.png
|
|
125
|
-
images/not_node_types2.gv
|
|
126
69
|
images/not_node_types2.png
|
|
127
70
|
images/power_set.gif
|
|
128
71
|
images/power_set.py
|
|
129
|
-
images/power_set0.gv
|
|
130
|
-
images/power_set0.png
|
|
131
|
-
images/power_set1.gv
|
|
132
72
|
images/power_set1.png
|
|
133
|
-
images/power_set10.gv
|
|
134
73
|
images/power_set10.png
|
|
135
|
-
images/power_set11.gv
|
|
136
74
|
images/power_set11.png
|
|
137
|
-
images/power_set12.gv
|
|
138
75
|
images/power_set12.png
|
|
139
|
-
images/power_set13.gv
|
|
140
76
|
images/power_set13.png
|
|
141
|
-
images/power_set14.gv
|
|
142
77
|
images/power_set14.png
|
|
143
|
-
images/power_set15.gv
|
|
144
78
|
images/power_set15.png
|
|
145
|
-
images/power_set16.gv
|
|
146
79
|
images/power_set16.png
|
|
147
|
-
images/power_set17.gv
|
|
148
80
|
images/power_set17.png
|
|
149
|
-
images/power_set18.gv
|
|
150
81
|
images/power_set18.png
|
|
151
|
-
images/power_set19.gv
|
|
152
82
|
images/power_set19.png
|
|
153
|
-
images/power_set2.gv
|
|
154
83
|
images/power_set2.png
|
|
155
|
-
images/power_set20.gv
|
|
156
84
|
images/power_set20.png
|
|
157
|
-
images/power_set21.gv
|
|
158
85
|
images/power_set21.png
|
|
159
|
-
images/power_set22.gv
|
|
160
86
|
images/power_set22.png
|
|
161
|
-
images/power_set23.gv
|
|
162
|
-
images/power_set23.png
|
|
163
|
-
images/power_set3.gv
|
|
164
87
|
images/power_set3.png
|
|
165
|
-
images/power_set4.gv
|
|
166
88
|
images/power_set4.png
|
|
167
|
-
images/power_set5.gv
|
|
168
89
|
images/power_set5.png
|
|
169
|
-
images/power_set6.gv
|
|
170
90
|
images/power_set6.png
|
|
171
|
-
images/power_set7.gv
|
|
172
91
|
images/power_set7.png
|
|
173
|
-
images/power_set8.gv
|
|
174
92
|
images/power_set8.png
|
|
175
|
-
images/power_set9.gv
|
|
176
93
|
images/power_set9.png
|
|
177
94
|
images/pyodide.png
|
|
178
|
-
images/rebinding1.gv
|
|
179
95
|
images/rebinding1.png
|
|
180
|
-
images/rebinding2.gv
|
|
181
96
|
images/rebinding2.png
|
|
182
97
|
images/uva.png
|
|
183
98
|
images/vscode_copying.gif
|
|
184
|
-
images/.ipynb_checkpoints/jupyter_example-checkpoint.ipynb
|
|
185
99
|
memory_graph/__init__.py
|
|
186
100
|
memory_graph/call_stack.py
|
|
187
101
|
memory_graph/config.py
|
|
@@ -202,6 +116,7 @@ memory_graph/slicer.py
|
|
|
202
116
|
memory_graph/slices.py
|
|
203
117
|
memory_graph/slices_iterator.py
|
|
204
118
|
memory_graph/slices_table_iterator.py
|
|
119
|
+
memory_graph/t.py
|
|
205
120
|
memory_graph/test.py
|
|
206
121
|
memory_graph/test_max_graph_depth.py
|
|
207
122
|
memory_graph/test_memory_graph.py
|
|
@@ -215,8 +130,4 @@ memory_graph.egg-info/PKG-INFO
|
|
|
215
130
|
memory_graph.egg-info/SOURCES.txt
|
|
216
131
|
memory_graph.egg-info/dependency_links.txt
|
|
217
132
|
memory_graph.egg-info/requires.txt
|
|
218
|
-
memory_graph.egg-info/top_level.txt
|
|
219
|
-
src/auto_memory_graph.py
|
|
220
|
-
src/jupyter_example.ipynb
|
|
221
|
-
src/pyodide.html
|
|
222
|
-
uml/memory_graph.uxf
|
|
133
|
+
memory_graph.egg-info/top_level.txt
|
|
@@ -11,7 +11,7 @@ long_description_from_readme = (this_directory / "README.md").read_text()
|
|
|
11
11
|
|
|
12
12
|
setup(
|
|
13
13
|
name = 'memory_graph',
|
|
14
|
-
version = '0.3.
|
|
14
|
+
version = '0.3.27',
|
|
15
15
|
description = 'Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy.',
|
|
16
16
|
long_description = long_description_from_readme,
|
|
17
17
|
long_description_content_type = 'text/markdown',
|