memory-graph 0.3.52__tar.gz → 0.3.53__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.52/memory_graph.egg-info → memory_graph-0.3.53}/PKG-INFO +13 -8
- {memory_graph-0.3.52 → memory_graph-0.3.53}/README.md +12 -7
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/avltree.py +16 -17
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/copy_mutable.py +1 -1
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/__init__.py +10 -2
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/slicer.py +1 -1
- {memory_graph-0.3.52 → memory_graph-0.3.53/memory_graph.egg-info}/PKG-INFO +13 -8
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph.egg-info/SOURCES.txt +0 -6
- {memory_graph-0.3.52 → memory_graph-0.3.53}/pyproject.toml +1 -1
- memory_graph-0.3.52/images/copies.png +0 -0
- memory_graph-0.3.52/images/copies_immutable.png +0 -0
- memory_graph-0.3.52/images/copies_mix.png +0 -0
- memory_graph-0.3.52/images/depth.png +0 -0
- memory_graph-0.3.52/images/hidden_edges2.png +0 -0
- memory_graph-0.3.52/images/memory_graph.gv.pdf +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/LICENSE.txt +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/MANIFEST.in +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/add_one.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/add_one.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/avltree_dir.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/avltree_fail.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/avltree_key_value.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/avltree_leaf.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/avltree_linear.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/avltree_table.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/bin_search.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/bin_search.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/bin_search_linear.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/bin_tree.gif +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/bin_tree.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/bin_tree.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/binary.gif +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/binary.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/colab_example.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/copy_immutable.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/copy_immutable.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/copy_method.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/copy_method.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/copy_mix.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/copy_mix.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/copy_mutable.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/create_gif.sh +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/create_images.sh +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/debug_vscode.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/debugging.gif +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/debugging.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/embedded1.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/embedded2.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/extension_numpy.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/extension_numpy.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/extension_pandas.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/extension_pandas.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/extension_torch.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/extension_torch.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/factorial.gif +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/factorial.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/hash_set.gif +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/hash_set.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/hash_set.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/hidden_edges.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/hidden_edges.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/immutable.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/immutable1.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/immutable2.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/introspect_depth.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/introspect_depth.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/ipython.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/jupyter_example.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/linked_list.gif +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/linked_list.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/linked_list.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/many_types.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/many_types.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/marimo_example.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/memory_graph_web_debugger.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/mutable.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/mutable1.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/mutable2.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/name_rebinding.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/not_node_types.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/power_set.gif +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/power_set.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/rebinding1.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/rebinding2.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/uva.png +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/images/vscode_copying.gif +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/call_stack.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/config.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/config_default.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/config_helpers.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/extension_numpy.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/extension_pandas.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/extension_torch.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/html_table.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/list_view.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/memory_to_nodes.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/node_base.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/node_key_value.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/node_leaf.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/node_linear.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/node_table.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/sequence.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/slices.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/slices_iterator.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/slices_table_iterator.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/test.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/test_max_graph_depth.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/test_memory_graph.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/test_memory_to_nodes.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/test_sequence.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/test_slicer.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/test_slices.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/test_slices_iterator.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph/utils.py +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph.egg-info/dependency_links.txt +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph.egg-info/requires.txt +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/memory_graph.egg-info/top_level.txt +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/setup.cfg +0 -0
- {memory_graph-0.3.52 → memory_graph-0.3.53}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.53
|
|
4
4
|
Summary: Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy.
|
|
5
5
|
Author-email: Bas Terwijn <bterwijn@gmail.com>
|
|
6
6
|
License: BSD 2-Clause License
|
|
@@ -553,6 +553,8 @@ for i in range(n):
|
|
|
553
553
|
Here we show values being added to a Linked List in Cursor AI. When adding the last value '5' we "Step Into" the code to show more of the details.
|
|
554
554
|

|
|
555
555
|
|
|
556
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/linked_list.py×tep=0.2&play).
|
|
557
|
+
|
|
556
558
|
## Binary Tree ##
|
|
557
559
|
```python
|
|
558
560
|
import memory_graph as mg
|
|
@@ -593,6 +595,7 @@ for i in range(n):
|
|
|
593
595
|
Here we show values being inserted in a Binary Tree in Visual Studio Code. When inserting the last value '29' we "Step Into" the code to show the recursive implementation.
|
|
594
596
|

|
|
595
597
|
|
|
598
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/bin_tree.py×tep=0.2&play).
|
|
596
599
|
|
|
597
600
|
## Hash Set ##
|
|
598
601
|
```python
|
|
@@ -636,6 +639,8 @@ for i in range(n):
|
|
|
636
639
|
Here we show values being inserted in a HashSet in PyCharm. When inserting the last value '44' we "Step Into" the code to show more of the details.
|
|
637
640
|

|
|
638
641
|
|
|
642
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/hash_set.py×tep=0.2&play).
|
|
643
|
+
|
|
639
644
|
# Configuration #
|
|
640
645
|
Different aspects of memory_graph can be configured. The default configuration can be reset by calling 'mg.config_default.reset()'.
|
|
641
646
|
|
|
@@ -746,9 +751,9 @@ tree.insert(20, "twenty")
|
|
|
746
751
|
tree.insert(15, "fifteen")
|
|
747
752
|
|
|
748
753
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
749
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
754
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Linear(data,
|
|
750
755
|
dir(data))
|
|
751
|
-
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.
|
|
756
|
+
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
752
757
|
|
|
753
758
|
mg.show(locals())
|
|
754
759
|
```
|
|
@@ -770,7 +775,7 @@ tree.insert(20, "twenty")
|
|
|
770
775
|
tree.insert(15, "fifteen")
|
|
771
776
|
|
|
772
777
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
773
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
778
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Leaf(data,
|
|
774
779
|
f"key:{data.key} value:{data.value}")
|
|
775
780
|
|
|
776
781
|
mg.show(locals())
|
|
@@ -791,7 +796,7 @@ tree.insert(20, "twenty")
|
|
|
791
796
|
tree.insert(15, "fifteen")
|
|
792
797
|
|
|
793
798
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
794
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
799
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Linear(data,
|
|
795
800
|
['left:', data.left,
|
|
796
801
|
'key:', data.key,
|
|
797
802
|
'value:', data.value,
|
|
@@ -815,7 +820,7 @@ tree.insert(20, "twenty")
|
|
|
815
820
|
tree.insert(15, "fifteen")
|
|
816
821
|
|
|
817
822
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
818
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
823
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Key_Value(data,
|
|
819
824
|
{'left': data.left,
|
|
820
825
|
'key': data.key,
|
|
821
826
|
'value': data.value,
|
|
@@ -839,7 +844,7 @@ tree.insert(20, "twenty")
|
|
|
839
844
|
tree.insert(15, "fifteen")
|
|
840
845
|
|
|
841
846
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
842
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
847
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Table(data,
|
|
843
848
|
[[data.key, data.value],
|
|
844
849
|
[data.left, data.right]] )
|
|
845
850
|
|
|
@@ -894,7 +899,7 @@ Arguably the visualization is then more clear when we show a List_View object as
|
|
|
894
899
|
|
|
895
900
|
```python
|
|
896
901
|
mg.config.type_to_color[List_View] = 'hotpink'
|
|
897
|
-
mg.config.type_to_node[List_View] = lambda data: mg.
|
|
902
|
+
mg.config.type_to_node[List_View] = lambda data: mg.Node_Linear(data,
|
|
898
903
|
data.lst[data.begin:data.end])
|
|
899
904
|
```
|
|
900
905
|

|
|
@@ -508,6 +508,8 @@ for i in range(n):
|
|
|
508
508
|
Here we show values being added to a Linked List in Cursor AI. When adding the last value '5' we "Step Into" the code to show more of the details.
|
|
509
509
|

|
|
510
510
|
|
|
511
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/linked_list.py×tep=0.2&play).
|
|
512
|
+
|
|
511
513
|
## Binary Tree ##
|
|
512
514
|
```python
|
|
513
515
|
import memory_graph as mg
|
|
@@ -548,6 +550,7 @@ for i in range(n):
|
|
|
548
550
|
Here we show values being inserted in a Binary Tree in Visual Studio Code. When inserting the last value '29' we "Step Into" the code to show the recursive implementation.
|
|
549
551
|

|
|
550
552
|
|
|
553
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/bin_tree.py×tep=0.2&play).
|
|
551
554
|
|
|
552
555
|
## Hash Set ##
|
|
553
556
|
```python
|
|
@@ -591,6 +594,8 @@ for i in range(n):
|
|
|
591
594
|
Here we show values being inserted in a HashSet in PyCharm. When inserting the last value '44' we "Step Into" the code to show more of the details.
|
|
592
595
|

|
|
593
596
|
|
|
597
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/hash_set.py×tep=0.2&play).
|
|
598
|
+
|
|
594
599
|
# Configuration #
|
|
595
600
|
Different aspects of memory_graph can be configured. The default configuration can be reset by calling 'mg.config_default.reset()'.
|
|
596
601
|
|
|
@@ -701,9 +706,9 @@ tree.insert(20, "twenty")
|
|
|
701
706
|
tree.insert(15, "fifteen")
|
|
702
707
|
|
|
703
708
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
704
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
709
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Linear(data,
|
|
705
710
|
dir(data))
|
|
706
|
-
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.
|
|
711
|
+
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
707
712
|
|
|
708
713
|
mg.show(locals())
|
|
709
714
|
```
|
|
@@ -725,7 +730,7 @@ tree.insert(20, "twenty")
|
|
|
725
730
|
tree.insert(15, "fifteen")
|
|
726
731
|
|
|
727
732
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
728
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
733
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Leaf(data,
|
|
729
734
|
f"key:{data.key} value:{data.value}")
|
|
730
735
|
|
|
731
736
|
mg.show(locals())
|
|
@@ -746,7 +751,7 @@ tree.insert(20, "twenty")
|
|
|
746
751
|
tree.insert(15, "fifteen")
|
|
747
752
|
|
|
748
753
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
749
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
754
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Linear(data,
|
|
750
755
|
['left:', data.left,
|
|
751
756
|
'key:', data.key,
|
|
752
757
|
'value:', data.value,
|
|
@@ -770,7 +775,7 @@ tree.insert(20, "twenty")
|
|
|
770
775
|
tree.insert(15, "fifteen")
|
|
771
776
|
|
|
772
777
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
773
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
778
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Key_Value(data,
|
|
774
779
|
{'left': data.left,
|
|
775
780
|
'key': data.key,
|
|
776
781
|
'value': data.value,
|
|
@@ -794,7 +799,7 @@ tree.insert(20, "twenty")
|
|
|
794
799
|
tree.insert(15, "fifteen")
|
|
795
800
|
|
|
796
801
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
797
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
802
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Table(data,
|
|
798
803
|
[[data.key, data.value],
|
|
799
804
|
[data.left, data.right]] )
|
|
800
805
|
|
|
@@ -849,7 +854,7 @@ Arguably the visualization is then more clear when we show a List_View object as
|
|
|
849
854
|
|
|
850
855
|
```python
|
|
851
856
|
mg.config.type_to_color[List_View] = 'hotpink'
|
|
852
|
-
mg.config.type_to_node[List_View] = lambda data: mg.
|
|
857
|
+
mg.config.type_to_node[List_View] = lambda data: mg.Node_Linear(data,
|
|
853
858
|
data.lst[data.begin:data.end])
|
|
854
859
|
```
|
|
855
860
|

|
|
@@ -15,29 +15,28 @@ tree.insert(15, "fifteen")
|
|
|
15
15
|
# mg.render(locals(), 'avltree_fail.png') # id keeps changing
|
|
16
16
|
|
|
17
17
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
18
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
19
|
-
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.
|
|
18
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Linear(data, dir(data))
|
|
19
|
+
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
20
20
|
# mg.render(locals(), 'avltree_dir.png') # stuff changes
|
|
21
21
|
|
|
22
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
22
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Leaf(data, f"key:{data.key} value:{data.value}")
|
|
23
23
|
mg.render(locals(), 'avltree_leaf.png')
|
|
24
24
|
|
|
25
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Linear(data,
|
|
26
|
+
['left:', data.left,
|
|
27
|
+
'key:', data.key,
|
|
28
|
+
'value:', data.value,
|
|
29
|
+
'right:', data.right])
|
|
30
30
|
mg.render(locals(), 'avltree_linear.png')
|
|
31
31
|
|
|
32
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Key_Value(data,
|
|
33
|
+
{'left': data.left,
|
|
34
|
+
'key': data.key,
|
|
35
|
+
'value': data.value,
|
|
36
|
+
'right': data.right}.items())
|
|
37
37
|
mg.render(locals(), 'avltree_key_value.png')
|
|
38
38
|
|
|
39
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
)
|
|
39
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Table(data,
|
|
40
|
+
[[data.key, data.value],
|
|
41
|
+
[data.left, data.right]])
|
|
43
42
|
mg.render(locals(), 'avltree_table.png')
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
# Copyright (c) 2023, Bas Terwijn.
|
|
3
3
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
4
4
|
|
|
5
|
+
__version__ = "0.3.53"
|
|
6
|
+
__author__ = 'Bas Terwijn'
|
|
7
|
+
|
|
5
8
|
import memory_graph.memory_to_nodes as memory_to_nodes
|
|
6
9
|
import memory_graph.config as config
|
|
7
10
|
import memory_graph.config_default
|
|
@@ -21,8 +24,13 @@ import builtins
|
|
|
21
24
|
if not hasattr(builtins, "mg"):
|
|
22
25
|
builtins.mg = mg
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
# re-exports for shorter names
|
|
28
|
+
from .slicer import Slicer
|
|
29
|
+
from .node_leaf import Node_Leaf
|
|
30
|
+
from .node_linear import Node_Linear
|
|
31
|
+
from .node_key_value import Node_Key_Value
|
|
32
|
+
from .node_table import Node_Table
|
|
33
|
+
|
|
26
34
|
|
|
27
35
|
last_show_filename = None
|
|
28
36
|
render_filename_count = 0
|
|
@@ -15,7 +15,7 @@ class Slicer:
|
|
|
15
15
|
self.end, self.middle = self.middle, self.end
|
|
16
16
|
|
|
17
17
|
def __repr__(self) -> str:
|
|
18
|
-
return f"Slicer({self.begin},{self.middle},{self.end})"
|
|
18
|
+
return f"Slicer({self.begin}, {self.middle}, {self.end})"
|
|
19
19
|
|
|
20
20
|
def get_slices(self, length):
|
|
21
21
|
slices1d = Slices1D()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memory_graph
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.53
|
|
4
4
|
Summary: Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy.
|
|
5
5
|
Author-email: Bas Terwijn <bterwijn@gmail.com>
|
|
6
6
|
License: BSD 2-Clause License
|
|
@@ -553,6 +553,8 @@ for i in range(n):
|
|
|
553
553
|
Here we show values being added to a Linked List in Cursor AI. When adding the last value '5' we "Step Into" the code to show more of the details.
|
|
554
554
|

|
|
555
555
|
|
|
556
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/linked_list.py×tep=0.2&play).
|
|
557
|
+
|
|
556
558
|
## Binary Tree ##
|
|
557
559
|
```python
|
|
558
560
|
import memory_graph as mg
|
|
@@ -593,6 +595,7 @@ for i in range(n):
|
|
|
593
595
|
Here we show values being inserted in a Binary Tree in Visual Studio Code. When inserting the last value '29' we "Step Into" the code to show the recursive implementation.
|
|
594
596
|

|
|
595
597
|
|
|
598
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/bin_tree.py×tep=0.2&play).
|
|
596
599
|
|
|
597
600
|
## Hash Set ##
|
|
598
601
|
```python
|
|
@@ -636,6 +639,8 @@ for i in range(n):
|
|
|
636
639
|
Here we show values being inserted in a HashSet in PyCharm. When inserting the last value '44' we "Step Into" the code to show more of the details.
|
|
637
640
|

|
|
638
641
|
|
|
642
|
+
Or see it in the [Memory Grah Web Debugger](https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/hash_set.py×tep=0.2&play).
|
|
643
|
+
|
|
639
644
|
# Configuration #
|
|
640
645
|
Different aspects of memory_graph can be configured. The default configuration can be reset by calling 'mg.config_default.reset()'.
|
|
641
646
|
|
|
@@ -746,9 +751,9 @@ tree.insert(20, "twenty")
|
|
|
746
751
|
tree.insert(15, "fifteen")
|
|
747
752
|
|
|
748
753
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
749
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
754
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Linear(data,
|
|
750
755
|
dir(data))
|
|
751
|
-
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.
|
|
756
|
+
mg.config.type_to_slicer[bintrees.avltree.Node] = mg.Slicer()
|
|
752
757
|
|
|
753
758
|
mg.show(locals())
|
|
754
759
|
```
|
|
@@ -770,7 +775,7 @@ tree.insert(20, "twenty")
|
|
|
770
775
|
tree.insert(15, "fifteen")
|
|
771
776
|
|
|
772
777
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
773
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
778
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Leaf(data,
|
|
774
779
|
f"key:{data.key} value:{data.value}")
|
|
775
780
|
|
|
776
781
|
mg.show(locals())
|
|
@@ -791,7 +796,7 @@ tree.insert(20, "twenty")
|
|
|
791
796
|
tree.insert(15, "fifteen")
|
|
792
797
|
|
|
793
798
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
794
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
799
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Linear(data,
|
|
795
800
|
['left:', data.left,
|
|
796
801
|
'key:', data.key,
|
|
797
802
|
'value:', data.value,
|
|
@@ -815,7 +820,7 @@ tree.insert(20, "twenty")
|
|
|
815
820
|
tree.insert(15, "fifteen")
|
|
816
821
|
|
|
817
822
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
818
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
823
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Key_Value(data,
|
|
819
824
|
{'left': data.left,
|
|
820
825
|
'key': data.key,
|
|
821
826
|
'value': data.value,
|
|
@@ -839,7 +844,7 @@ tree.insert(20, "twenty")
|
|
|
839
844
|
tree.insert(15, "fifteen")
|
|
840
845
|
|
|
841
846
|
mg.config.type_to_color[bintrees.avltree.Node] = "sandybrown"
|
|
842
|
-
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.
|
|
847
|
+
mg.config.type_to_node[bintrees.avltree.Node] = lambda data: mg.Node_Table(data,
|
|
843
848
|
[[data.key, data.value],
|
|
844
849
|
[data.left, data.right]] )
|
|
845
850
|
|
|
@@ -894,7 +899,7 @@ Arguably the visualization is then more clear when we show a List_View object as
|
|
|
894
899
|
|
|
895
900
|
```python
|
|
896
901
|
mg.config.type_to_color[List_View] = 'hotpink'
|
|
897
|
-
mg.config.type_to_node[List_View] = lambda data: mg.
|
|
902
|
+
mg.config.type_to_node[List_View] = lambda data: mg.Node_Linear(data,
|
|
898
903
|
data.lst[data.begin:data.end])
|
|
899
904
|
```
|
|
900
905
|

|
|
@@ -21,9 +21,6 @@ images/bin_tree.py
|
|
|
21
21
|
images/binary.gif
|
|
22
22
|
images/binary.py
|
|
23
23
|
images/colab_example.png
|
|
24
|
-
images/copies.png
|
|
25
|
-
images/copies_immutable.png
|
|
26
|
-
images/copies_mix.png
|
|
27
24
|
images/copy_immutable.png
|
|
28
25
|
images/copy_immutable.py
|
|
29
26
|
images/copy_method.png
|
|
@@ -37,7 +34,6 @@ images/create_images.sh
|
|
|
37
34
|
images/debug_vscode.png
|
|
38
35
|
images/debugging.gif
|
|
39
36
|
images/debugging.py
|
|
40
|
-
images/depth.png
|
|
41
37
|
images/embedded1.png
|
|
42
38
|
images/embedded2.png
|
|
43
39
|
images/extension_numpy.png
|
|
@@ -53,7 +49,6 @@ images/hash_set.png
|
|
|
53
49
|
images/hash_set.py
|
|
54
50
|
images/hidden_edges.png
|
|
55
51
|
images/hidden_edges.py
|
|
56
|
-
images/hidden_edges2.png
|
|
57
52
|
images/immutable.py
|
|
58
53
|
images/immutable1.png
|
|
59
54
|
images/immutable2.png
|
|
@@ -67,7 +62,6 @@ images/linked_list.py
|
|
|
67
62
|
images/many_types.png
|
|
68
63
|
images/many_types.py
|
|
69
64
|
images/marimo_example.png
|
|
70
|
-
images/memory_graph.gv.pdf
|
|
71
65
|
images/memory_graph_web_debugger.png
|
|
72
66
|
images/mutable.py
|
|
73
67
|
images/mutable1.png
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "memory_graph"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.53"
|
|
8
8
|
description = "Teaching tool and debugging aid in context of references, mutable data types, and shallow and deep copy."
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Bas Terwijn", email = "bterwijn@gmail.com"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|