visualdsa


Namevisualdsa JSON
Version 0.0.6 PyPI version JSON
download
home_pageNone
SummaryGenerates visually appealing representations of data structures.
upload_time2025-02-07 10:58:32
maintainerNone
docs_urlNone
authorSutheera Pitakpalin
requires_pythonNone
licenseMIT
keywords data structure
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
This Python library provides functions for visualizing various data structures, including linked lists, queue, stack, and more. It utilizes Matplotlib for creating interactive and informative visualizations.

This library was developed for the Data Structures and Algorithms course at King Mongkut's Institute of Technology Ladkrabang (KMITL) to enhance student understanding of these fundamental concepts.
## Table of Contents  
Data Visualization
- [Stack](#stack)
- [Queue](#Queue)
- [Singly Linked List](#Singly-Linked-List) 


Sorting Visualization
- [Bubble Sort](#Bubble-Sort) 
- [Selection Sort](#Selection-Sort) 
- [Insertion Sort](#Insertion-Sort) 
## Installation

Install using pip

```bash
pip install visualdsa
```
    


## Stack
#### Context
- A stack is a linear data structure that follows the Last-In, First-Out (LIFO) principle.
- Imagine a stack of plates – you can only add or remove plates from the top of the stack.


#### Sample stack class
```python
class ArrayStack:
  def __init__(self):
    self._data = []

  def __len__(self):
    return len(self._data)
  
  # ... (class methods)
```

#### Visualization
```python
import visualdsa as vd

# Sample stack data
my_stack = ArrayStack()
my_stack._data = [3, 2, 1]

# Visualize the stack
vd.showStack(my_stack)
```
![](https://img2.pic.in.th/pic/Unknown-8-2.png)

## Queue
#### Context
- A circular queue is a linear data structure that follows the First-In, First-Out (FIFO) principle, like a regular queue, but with a circular arrangement.
- The last element of the queue is logically connected to the first element, creating a circular structure. This efficient use of space by avoiding wasted memory at the beginning of the array.
- There are 2 pointers, front and rear, track the positions of the first and last elements in the queue, respectively.
#### Sample circular queue class
```python
class ArrayQueue:
  def __init__(self):
    self._data = [None] * 5   # A list to store the queue elements with capacity of 5
    self._front = 0           # The index of the front of the queue
    self._rear = 0            # he index of the rear of the queue

  def __len__(self):
    return len(self._data)
  
  # ... (class methods)

```

#### Visualization
```python
import visualdsa as vd

# Sample queue data
my_queue = ArrayQueue()
my_queue._data = [3, 2, 1, None, None]
my_queue._front = 0
my_queue._rear = 2

# Visualize the queue
vd.showQueue(my_queue)
```
![](https://img2.pic.in.th/pic/Unknown-9-2.png)

## Singly Linked List
#### Context
- A singly linked list is a linear data structure where each element (node) points to the next element in the sequence.

#### Sample singly linked list class
```python
class DataNode:
  def __init__(self, name, next):
    self._name = name     # The value stored within the node
    self._next = next     # A reference to the next node in the list (None if it's the last node)

class SinglyLinkedList():
  def __init__(self):
    self._count = 0       # The number of nodes in the list
    self._head = None     # A reference to the first node of the list 

  # ... (class methods)

```

#### Visualization
```python
import visualdsa as vd

# Sample linked list data
my_list = SinglyLinkedList()
my_node1 = DataNode("John", None)
my_node2 = DataNode("Adam", my_node1)
my_list._head = my_node2
my_list._count += 2

# Visualize the linked list
vd.showSinglyLinkedList(my_list)
```
![](https://img5.pic.in.th/file/secure-sv1/Unknown-10-2.png)

## Bubble Sort
#### Context
- Compares adjacent elements and swaps them if they are in the wrong order.
- Repeatedly passes through the list until no swaps1 occur in a pass.

#### Visualization
```python
import visualdsa as vd

arr = [12, 90, 53, 63]
vd.bubbleSort(arr)
```

![](https://img5.pic.in.th/file/secure-sv1/bubleac1d0a5ce51496f1.png)


## Selection Sort
#### Context
- Finds the minimum element in the unsorted portion of the list and places it at the beginning.
- Repeats this process until the entire list is sorted.

#### Visualization
```python
import visualdsa as vd

arr = [12, 90, 53, 63]
vd.selectionSort(arr)
```

![](https://img5.pic.in.th/file/secure-sv1/selection45f61e7a5eea5d99.png)


## Insertion Sort
#### Context
- Builds the sorted array one element at a time.
- Inserts each element into its correct position within the already sorted portion of the array.

#### Visualization
```python
import visualdsa as vd

arr = [12, 90, 53, 63]
vd.insertionSort(arr)
```

![](https://img2.pic.in.th/pic/insertion408de62f7f106725.png)

Change Log
==========

0.0.1 (21/01/2025)
------------------
- First Release

0.0.2 (21/01/2025)
------------------
- Debug module

0.0.3 (21/01/2025)
------------------
- Clear tester

0.0.4 (22/01/2025)
------------------
- Corrected the date in previous changelog
- Updated README.txt with improved documentation, including installation and usage
- Refactored function names to accurately reflect the data structure
    - `showQueue()` to `showCircularQueue()`
    - `showLinkedList()` to `showSinglyLinkedList()`

0.0.5 (07/02/2025)
------------------
- Refactored the `SinglyLinkedList` sample class for better code organization and readability.
- Added checks for node count mismatches in the linked list visualization and displays a more informative warning message.
- Implemented visualizations for Bubble Sort, Selection Sort, and Insertion Sort, including visual representations of the sorting process.
- Updated the README.md documentation for the new visualization features.

0.0.6 (07/02/2025)
------------------
- Updated the README.md table of contents
- Fixed an issue where the example output images in the README.md were outdated or missing. 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "visualdsa",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "data structure",
    "author": "Sutheera Pitakpalin",
    "author_email": "s.pitakpalin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/60/1a/b562f5d3acdd8e884eccc1e8747686a3a76b478bed54ae8c89a99a34cd48/visualdsa-0.0.6.tar.gz",
    "platform": null,
    "description": "\nThis Python library provides functions for visualizing various data structures, including linked lists, queue, stack, and more. It utilizes Matplotlib for creating interactive and informative visualizations.\n\nThis library was developed for the Data Structures and Algorithms course at King Mongkut's Institute of Technology Ladkrabang (KMITL) to enhance student understanding of these fundamental concepts.\n## Table of Contents  \nData Visualization\n- [Stack](#stack)\n- [Queue](#Queue)\n- [Singly Linked List](#Singly-Linked-List) \n\n\nSorting Visualization\n- [Bubble Sort](#Bubble-Sort) \n- [Selection Sort](#Selection-Sort) \n- [Insertion Sort](#Insertion-Sort) \n## Installation\n\nInstall using pip\n\n```bash\npip install visualdsa\n```\n    \n\n\n## Stack\n#### Context\n- A stack is a linear data structure that follows the Last-In, First-Out (LIFO) principle.\n- Imagine a stack of plates \u2013 you can only add or remove plates from the top of the stack.\n\n\n#### Sample stack class\n```python\nclass ArrayStack:\n  def __init__(self):\n    self._data = []\n\n  def __len__(self):\n    return len(self._data)\n  \n  # ... (class methods)\n```\n\n#### Visualization\n```python\nimport visualdsa as vd\n\n# Sample stack data\nmy_stack = ArrayStack()\nmy_stack._data = [3, 2, 1]\n\n# Visualize the stack\nvd.showStack(my_stack)\n```\n![](https://img2.pic.in.th/pic/Unknown-8-2.png)\n\n## Queue\n#### Context\n- A circular queue is a linear data structure that follows the First-In, First-Out (FIFO) principle, like a regular queue, but with a circular arrangement.\n- The last element of the queue is logically connected to the first element, creating a circular structure. This efficient use of space by avoiding wasted memory at the beginning of the array.\n- There are 2 pointers, front and rear, track the positions of the first and last elements in the queue, respectively.\n#### Sample circular queue class\n```python\nclass ArrayQueue:\n  def __init__(self):\n    self._data = [None] * 5   # A list to store the queue elements with capacity of 5\n    self._front = 0           # The index of the front of the queue\n    self._rear = 0            # he index of the rear of the queue\n\n  def __len__(self):\n    return len(self._data)\n  \n  # ... (class methods)\n\n```\n\n#### Visualization\n```python\nimport visualdsa as vd\n\n# Sample queue data\nmy_queue = ArrayQueue()\nmy_queue._data = [3, 2, 1, None, None]\nmy_queue._front = 0\nmy_queue._rear = 2\n\n# Visualize the queue\nvd.showQueue(my_queue)\n```\n![](https://img2.pic.in.th/pic/Unknown-9-2.png)\n\n## Singly Linked List\n#### Context\n- A singly linked list is a linear data structure where each element (node) points to the next element in the sequence.\n\n#### Sample singly linked list class\n```python\nclass DataNode:\n  def __init__(self, name, next):\n    self._name = name     # The value stored within the node\n    self._next = next     # A reference to the next node in the list (None if it's the last node)\n\nclass SinglyLinkedList():\n  def __init__(self):\n    self._count = 0       # The number of nodes in the list\n    self._head = None     # A reference to the first node of the list \n\n  # ... (class methods)\n\n```\n\n#### Visualization\n```python\nimport visualdsa as vd\n\n# Sample linked list data\nmy_list = SinglyLinkedList()\nmy_node1 = DataNode(\"John\", None)\nmy_node2 = DataNode(\"Adam\", my_node1)\nmy_list._head = my_node2\nmy_list._count += 2\n\n# Visualize the linked list\nvd.showSinglyLinkedList(my_list)\n```\n![](https://img5.pic.in.th/file/secure-sv1/Unknown-10-2.png)\n\n## Bubble Sort\n#### Context\n- Compares adjacent elements and swaps them if they are in the wrong order.\n- Repeatedly passes through the list until no swaps1 occur in a pass.\n\n#### Visualization\n```python\nimport visualdsa as vd\n\narr = [12, 90, 53, 63]\nvd.bubbleSort(arr)\n```\n\n![](https://img5.pic.in.th/file/secure-sv1/bubleac1d0a5ce51496f1.png)\n\n\n## Selection Sort\n#### Context\n- Finds the minimum element in the unsorted portion of the list and places it at the beginning.\n- Repeats this process until the entire list is sorted.\n\n#### Visualization\n```python\nimport visualdsa as vd\n\narr = [12, 90, 53, 63]\nvd.selectionSort(arr)\n```\n\n![](https://img5.pic.in.th/file/secure-sv1/selection45f61e7a5eea5d99.png)\n\n\n## Insertion Sort\n#### Context\n- Builds the sorted array one element at a time.\n- Inserts each element into its correct position within the already sorted portion of the array.\n\n#### Visualization\n```python\nimport visualdsa as vd\n\narr = [12, 90, 53, 63]\nvd.insertionSort(arr)\n```\n\n![](https://img2.pic.in.th/pic/insertion408de62f7f106725.png)\n\nChange Log\n==========\n\n0.0.1 (21/01/2025)\n------------------\n- First Release\n\n0.0.2 (21/01/2025)\n------------------\n- Debug module\n\n0.0.3 (21/01/2025)\n------------------\n- Clear tester\n\n0.0.4 (22/01/2025)\n------------------\n- Corrected the date in previous changelog\n- Updated README.txt with improved documentation, including installation and usage\n- Refactored function names to accurately reflect the data structure\n    - `showQueue()` to `showCircularQueue()`\n    - `showLinkedList()` to `showSinglyLinkedList()`\n\n0.0.5 (07/02/2025)\n------------------\n- Refactored the `SinglyLinkedList` sample class for better code organization and readability.\n- Added checks for node count mismatches in the linked list visualization and displays a more informative warning message.\n- Implemented visualizations for Bubble Sort, Selection Sort, and Insertion Sort, including visual representations of the sorting process.\n- Updated the README.md documentation for the new visualization features.\n\n0.0.6 (07/02/2025)\n------------------\n- Updated the README.md table of contents\n- Fixed an issue where the example output images in the README.md were outdated or missing. \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generates visually appealing representations of data structures.",
    "version": "0.0.6",
    "project_urls": null,
    "split_keywords": [
        "data",
        "structure"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "601ab562f5d3acdd8e884eccc1e8747686a3a76b478bed54ae8c89a99a34cd48",
                "md5": "54bcf3fb1385a9b90d54ed690cf39090",
                "sha256": "a6e9f58a580311b3e336d022fa501a2322dfc99319097e53a0593c886fa103c2"
            },
            "downloads": -1,
            "filename": "visualdsa-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "54bcf3fb1385a9b90d54ed690cf39090",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7161,
            "upload_time": "2025-02-07T10:58:32",
            "upload_time_iso_8601": "2025-02-07T10:58:32.060140Z",
            "url": "https://files.pythonhosted.org/packages/60/1a/b562f5d3acdd8e884eccc1e8747686a3a76b478bed54ae8c89a99a34cd48/visualdsa-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-07 10:58:32",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "visualdsa"
}
        
Elapsed time: 1.55075s