#memory_graph — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #memory_graph, aggregated by home.social.
-
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise23.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model
The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening. -
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise10.py&breakpoints=13&continues=1&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Two different Binary Tree implementations side by side:
https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_examples/refs/heads/main/bin_tree_impl.py×tep=0.2&play🔗 Binary Tree as Nodes
Built out of multiple node objects. Each node stores its value and two references, one to its left child and one to its right child.📦 Binary Tree as List
A single list or array. Instead of references, indices represent the relationships between nodes. For a node at index, its children can be found using a simple calculation.Which would you use?
-
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise18.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-modelThe “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://github.com/bterwijn/memory_graph#readme
-
The difference in Python OOP between:
- instance method
- class method
- static method
visually explained using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/different_methods.py&play
#Python #memory_graph #oop -
Common 𝗱𝗶𝗰𝘁 operations in Python.
Run this and more in Memory Graph Web Debugger:https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_examples/refs/heads/main/dict_operations.py&play -
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise19.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-modelThe “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://lnkd.in/e3sUM7wG
-
Ever wondered what a Trie actually looks like in memory?
A Trie is a tree of dictionaries, often used for problems like:
- prefix search
- word completion
- spell checking
- sequence matchingPackage 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 can show how data structures like Trie grow step by step. Instead of only reading code, you can see data structures being built in memory.
Run the live demo: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/build_trie.py×tep=0.2&play
More 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 examples: https://www.linkedin.com/groups/13244150/
-
Common 𝗹𝗶𝘀𝘁 operations in Python.
Run this and more in Memory Graph Web Debugger: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_examples/refs/heads/main/list_operations.py&play -
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise18.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Common 𝘀𝗲𝘁 operation in Python.
Run it in Memory Graph Web Debugger: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_examples/refs/heads/main/set_operations.py&play -
Common 𝘀𝗲𝘁 operation in Python.
Run it in Memory Graph Web Debugger: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_examples/refs/heads/main/set_operations.py&play -
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise15.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-modelThe “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://github.com/bterwijn/memory_graph
-
How does Radix Sort work?
Algorithms like Radix Sort: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/radix_sort.py×tep=0.2&play
are much easier to understand when you can see every intermediate step.Using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://github.com/bterwijn/memory_graph#readme
you can watch how Radix Sort repeatedly applies stable Counting Sort, sorting the least significant digit up to the most significant digit in turn.Radix Sort is be very efficient, with time complexity O(n · d), where 'n' is the number of values and 'd' is the number of digits.
-
Algorithms can be easier understood with step-by-step visualization using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵. Here we show a Breadth First algorithm that finds the shortest path in a graph from node 'a' to node 'b': https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/breadth_first.py&breakpoints=31&continues=1×tep=0.2&play
𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 github: https://github.com/bterwijn/memory_graph#readme
-
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise12.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-modelThe “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://lnkd.in/e3sUM7wG
-
Data Structures in Python get easy when you can simply see the structure of your data using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵. A Hash_Set example: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/hash_set.py&breakpoints=32&continues=1×tep=0.2&play
𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://github.com/bterwijn/memory_graph#readme
-
Data Structures in Python get easy when you can simply see the structure of your data using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵. A Hash_Set example: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/hash_set.py&breakpoints=32&continues=1×tep=0.2&play
𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://github.com/bterwijn/memory_graph#readme
-
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise9.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-modelThe “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: https://github.com/bterwijn/memory_graph
-
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise4_mg.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-modelThe “Solution” link uses 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 to visualize execution and reveals what’s actually happening.
-
Automatic data structure visualization in your IDE using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵:
- web debugger binary tree demo: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/bin_tree.py×tep=0.2&play
- setup video for VS Code: https://youtu.be/23_bHcr7hqo -
An exercise to help build the right mental model for Python data.
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise1.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-modelThe “Solution” link uses 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 to visualize execution and reveals what’s actually happening.
-
An exercise to help build the right mental model for Python data. The “Solution” link uses 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise2.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Understanding a data structure like linked list in Python is a lot easier when you can just see it. Linked_List demo: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/linked_list.py×tep=0.2&play
𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 visualizes Python objects and references, so data structures stop being abstract and become something you can debug with ease. No more endless print-debugging. No more stepping through 50 frames just to find one sneaky reference/aliasing mistake.
-
Understanding a data structure like linked list in Python is a lot easier when you can just see it. Linked_List demo: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/linked_list.py×tep=0.2&play
𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 visualizes Python objects and references, so data structures stop being abstract and become something you can debug with ease. No more endless print-debugging. No more stepping through 50 frames just to find one sneaky reference/aliasing mistake.
-
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise7.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise7.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Teaching data structures in Python gets easier with 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 visualizations. Data structures are no longer abstract concepts but concrete, clear and easy to debug.
This Hash_Map (Hash_Table) is a Python implementation similar to 'dict'. The demo visualizes:
- adding key–value pairs
- rehashing
- lookup by key
- iterating over keys -
Teaching data structures in Python gets easier with 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 visualizations. Data structures are no longer abstract concepts but concrete, clear and easy to debug.
This Hash_Map (Hash_Table) is a Python implementation similar to 'dict'. The demo visualizes:
- adding key–value pairs
- rehashing
- lookup by key
- iterating over keys -
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise16.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise16.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Four options for 𝐂𝐨𝐩𝐲 in Python:
𝚒𝚖𝚙𝚘𝚛𝚝 𝚌𝚘𝚙𝚢
𝚍𝚎𝚏 𝚌𝚞𝚜𝚝𝚘𝚖_𝚌𝚘𝚙𝚢(𝚊):
... 𝚌 = 𝚊.𝚌𝚘𝚙𝚢()
... 𝚌[𝟷] = 𝚊[𝟷].𝚌𝚘𝚙𝚢()
... 𝚛𝚎𝚝𝚞𝚛𝚗 𝚌𝚊 = [[𝟷, 𝟸], [𝟹, 𝟺]]
𝚌𝟷 = 𝚊
𝚌𝟸 = 𝚊.𝚌𝚘𝚙𝚢()
𝚌𝟹 = 𝚌𝚞𝚜𝚝𝚘𝚖_𝚌𝚘𝚙𝚢(𝚊)
𝚌𝟺 = 𝚌𝚘𝚙𝚢.𝚍𝚎𝚎𝚙𝚌𝚘𝚙𝚢(𝚊)c1, 𝐚𝐬𝐬𝐢𝐠𝐧𝐦𝐞𝐧𝐭: nothing is copied, everything is shared
c2, 𝐬𝐡𝐚𝐥𝐥𝐨𝐰 𝐜𝐨𝐩𝐲: first value is copied, underlying is shared
c3, 𝐜𝐮𝐬𝐭𝐨𝐦 𝐜𝐨𝐩𝐲: you decide what is copied and shared
c4, 𝐝𝐞𝐞𝐩 𝐜𝐨𝐩𝐲: everything is copied, nothing is sharedsee: https://memory-graph.com/#breakpoints=8&continues=1&play
-
Four options for 𝐂𝐨𝐩𝐲 in Python:
𝚒𝚖𝚙𝚘𝚛𝚝 𝚌𝚘𝚙𝚢
𝚍𝚎𝚏 𝚌𝚞𝚜𝚝𝚘𝚖_𝚌𝚘𝚙𝚢(𝚊):
... 𝚌 = 𝚊.𝚌𝚘𝚙𝚢()
... 𝚌[𝟷] = 𝚊[𝟷].𝚌𝚘𝚙𝚢()
... 𝚛𝚎𝚝𝚞𝚛𝚗 𝚌𝚊 = [[𝟷, 𝟸], [𝟹, 𝟺]]
𝚌𝟷 = 𝚊
𝚌𝟸 = 𝚊.𝚌𝚘𝚙𝚢()
𝚌𝟹 = 𝚌𝚞𝚜𝚝𝚘𝚖_𝚌𝚘𝚙𝚢(𝚊)
𝚌𝟺 = 𝚌𝚘𝚙𝚢.𝚍𝚎𝚎𝚙𝚌𝚘𝚙𝚢(𝚊)c1, 𝐚𝐬𝐬𝐢𝐠𝐧𝐦𝐞𝐧𝐭: nothing is copied, everything is shared
c2, 𝐬𝐡𝐚𝐥𝐥𝐨𝐰 𝐜𝐨𝐩𝐲: first value is copied, underlying is shared
c3, 𝐜𝐮𝐬𝐭𝐨𝐦 𝐜𝐨𝐩𝐲: you decide what is copied and shared
c4, 𝐝𝐞𝐞𝐩 𝐜𝐨𝐩𝐲: everything is copied, nothing is sharedsee: https://memory-graph.com/#breakpoints=8&continues=1&play
-
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise15.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise15.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Visualization of Python execution can help beginners to understand how their program state changes over time and to debug any remaining issues.
For example, a classic intro-course exercise — computing which coins to use to pay an amount using a greedy approach:
https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/make_change.py&breakpoints=21&continues=1×tep=0.5&play -
Visualization of Python execution can help beginners to understand how their program state changes over time and to debug any remaining issues.
For example, a classic intro-course exercise — computing which coins to use to pay an amount using a greedy approach:
https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/make_change.py&breakpoints=21&continues=1×tep=0.5&play -
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise5.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise5.py&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Data structures like Trie: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/build_trie.py&breakpoints=40,42,43&continues=1×tep=0.2&play
can in Python be easier understood and debugged after visualization using the memory_graph package: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#installationA Trie is a tree of dictionaries and can be used for things like word completion.
-
Data structures like Trie: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/build_trie.py&breakpoints=40,42,43&continues=1×tep=0.2&play
can in Python be easier understood and debugged after visualization using the memory_graph package: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#installationA Trie is a tree of dictionaries and can be used for things like word completion.
-
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise11.py&breakpoints=13&continues=1&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Algorithms like Cocktail Shaker Sort: https://lnkd.in/e5e7FUeu
(Bubble Sort in both directions) are easier to understand after visualization using memory_graph: https://lnkd.in/ePFhkAfH -
Here’s Selection Sort running with memory_graph. You can see the updating of `min_value` and the swaps of list elements in each step. Run a one-click live demo in Memory Graph Web Debugger: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/selection_sort.py&breakpoints=13,27&continues=1×tep=0.2&play
Visual feedback like this helps beginners grasp what the code does and debug with confidence. -
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise14.py&breakpoints=9&continues=1&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-model -
Teaching and learning Python data structures gets much easier when you can see the structure of your data in real time using the open-source memory_graph package. Here is a 'Binary Tree' example:
https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph/refs/heads/main/src/bin_tree.py×tep=0.2&play -
A Sliding Puzzle Solver as a challenging demo in the Memory Graph Web Debugger. Click "Continue" to step through the breadth-first search generations until a solution path is found:
The visualization isn't flawless at this size, but memory_graph still provides real insight for program understanding and debugging, even as the graph grows large.
-
Understanding and debugging Data Structures is easier when you can see the structure of your data using memory_graph: https://github.com/bterwijn/memory_graph
In this example we show values being inserted in a Binary Tree. When inserting the last value '29' we "Step Into" the code to show the recursive implementation: https://shorturl.at/bx848
🎥 See the Quick Intro video for the VS Code integration: https://youtu.be/23_bHcr7hqo
#Python #BinaryTree #Tree #DataStructure #memory_graph #debug