# BigDataLib
**BigDataLib** is a Python library that provides direct implementations of various big data structures, allowing you to work with these structures efficiently using simple functions. This library includes support for graphs, trees, and more.
## Features
- **Adjacency Matrix**: Efficient representation and manipulation of graph edges.
- **Adjacency List**: Lightweight representation of graph edges with fast access.
- **Trie (Prefix Tree)**: Fast prefix-based search and insertion for strings.
- **Segment Tree**: Efficient range queries and updates.
- **Fenwick Tree (Binary Indexed Tree)**: Fast updates and prefix sum queries.
- **Red-Black Tree**: Self-balancing binary search tree with efficient insertions and deletions.
- **AVL Tree**: Self-balancing binary search tree maintaining height balance.
- **Skip List**: Probabilistic data structure for fast search, insertion, and deletion.
- **B-Tree**: Balanced tree used for efficient data retrieval in databases.
- **B+ Tree**: Similar to B-Tree but with all values stored in leaf nodes.
## Installation
You can install the library using pip:
```bash
pip install bigdata_lib
```
# Usage
## 1.Adjacency Matrix
The adjacency matrix is a 2D array used to represent graph edges. It is memory-intensive but straightforward.
```bash
from bigdata_lib.adjacency_matrix import create_adjacency_matrix, add_edge_matrix, display_matrix
matrix = create_adjacency_matrix(5)
add_edge_matrix(matrix, 1, 2)
display_matrix(matrix)
```
## 2.Adjacency List
The adjacency list is a dictionary where keys are nodes and values are lists of adjacent nodes.
```bash
from bigdata_lib.adjacency_list import add_edge_list, display_list
graph = {}
add_edge_list(graph, 1, 2)
display_list(graph)
```
## 3.Trie (Prefix Tree)
A trie is a tree used for storing strings in a way that allows for fast retrieval of prefixes.
```bash
from bigdata_lib.trie_structure import Trie, TrieNode
trie = Trie()
trie.insert("example")
print(trie.search("example")) # Output: True
print(trie.search("test")) # Output: False
```
## 4.Segment Tree
A segment tree is used for storing intervals or segments, allowing efficient querying and updating.
```bash
from bigdata_lib.segment_tree import SegmentTree
arr = [1, 3, 5, 7, 9, 11]
segment_tree = SegmentTree(arr)
print(segment_tree.query(1, 3)) # Output: 15
segment_tree.update(1, 10)
print(segment_tree.query(1, 3)) # Output: 22
```
## 5.Fenwick Tree (Binary Indexed Tree)
A Fenwick Tree is used for efficient range queries and updates.
```bash
from bigdata_lib.fenwick_tree import FenwickTree
arr = [1, 3, 5, 7, 9, 11]
fenwick_tree = FenwickTree(arr)
print(fenwick_tree.query(3)) # Output: 16
fenwick_tree.update(1, 10)
print(fenwick_tree.query(3)) # Output: 26
```
## 6.Red-Black Tree
A Red-Black Tree is a self-balancing binary search tree with specific rules to ensure balanced height.
```bash
from bigdata_lib.red_black_tree import RedBlackTree
rb_tree = RedBlackTree()
rb_tree.insert(10)
rb_tree.insert(20)
rb_tree.insert(15)
# Implement traversal or other operations as needed
```
## 7.AVL Tree
An AVL Tree is a self-balancing binary search tree where the height difference between left and right subtrees is maintained.
```bash
from bigdata_lib.avl_tree import AVLTree
avl_tree = AVLTree()
root = None
root = avl_tree.insert(root, 10)
root = avl_tree.insert(root, 20)
root = avl_tree.insert(root, 15)
# Implement traversal or other operations as needed
```
## 8.Skip List
A Skip List is a probabilistic data structure that allows fast search, insertion, and deletion operations.
```bash
from bigdata_lib.skip_list import SkipList
skip_list = SkipList(max_level=3, p=0.5)
skip_list.insert(3)
skip_list.insert(6)
skip_list.insert(7)
print(skip_list.search(6)) # Output: True
print(skip_list.search(4)) # Output: False
```
## 9.B-Tree
A B-Tree is a balanced tree used for efficient data retrieval and insertion, often used in database systems.
```bash
from bigdata_lib.b_tree import BTree
b_tree = BTree(t=2)
b_tree.insert(10)
b_tree.insert(20)
b_tree.insert(5)
# Implement traversal or other operations as needed
```
## 10.B+ Tree
A B+ Tree is similar to a B-Tree but with all values stored in leaf nodes, allowing efficient range queries.
```bash
from bigdata_lib.bplus_tree import BPlusTree
bplus_tree = BPlusTree(t=2)
bplus_tree.insert(10)
bplus_tree.insert(20)
bplus_tree.insert(5)
# Implement traversal or other operations as needed
```
# Contributing
Contributions are welcome! Please submit a pull request or open an issue to suggest improvements.
# License
This project is licensed under the MIT License - see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/AdityaSrivastavDS/bigdata_lib",
"name": "bigdata-lib",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Aditya",
"author_email": "adityathestar2006@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ad/8a/e06ef09888880fd8bf36e66893bdc13920708fa0846bb2b45340636da18f/bigdata_lib-0.2.tar.gz",
"platform": null,
"description": "# BigDataLib\r\n\r\n**BigDataLib** is a Python library that provides direct implementations of various big data structures, allowing you to work with these structures efficiently using simple functions. This library includes support for graphs, trees, and more.\r\n\r\n## Features\r\n\r\n- **Adjacency Matrix**: Efficient representation and manipulation of graph edges.\r\n- **Adjacency List**: Lightweight representation of graph edges with fast access.\r\n- **Trie (Prefix Tree)**: Fast prefix-based search and insertion for strings.\r\n- **Segment Tree**: Efficient range queries and updates.\r\n- **Fenwick Tree (Binary Indexed Tree)**: Fast updates and prefix sum queries.\r\n- **Red-Black Tree**: Self-balancing binary search tree with efficient insertions and deletions.\r\n- **AVL Tree**: Self-balancing binary search tree maintaining height balance.\r\n- **Skip List**: Probabilistic data structure for fast search, insertion, and deletion.\r\n- **B-Tree**: Balanced tree used for efficient data retrieval in databases.\r\n- **B+ Tree**: Similar to B-Tree but with all values stored in leaf nodes.\r\n\r\n## Installation\r\n\r\nYou can install the library using pip:\r\n\r\n```bash\r\npip install bigdata_lib\r\n```\r\n\r\n# Usage\r\n\r\n## 1.Adjacency Matrix\r\nThe adjacency matrix is a 2D array used to represent graph edges. It is memory-intensive but straightforward.\r\n```bash\r\nfrom bigdata_lib.adjacency_matrix import create_adjacency_matrix, add_edge_matrix, display_matrix\r\n\r\nmatrix = create_adjacency_matrix(5)\r\nadd_edge_matrix(matrix, 1, 2)\r\ndisplay_matrix(matrix)\r\n```\r\n\r\n## 2.Adjacency List\r\nThe adjacency list is a dictionary where keys are nodes and values are lists of adjacent nodes.\r\n```bash\r\nfrom bigdata_lib.adjacency_list import add_edge_list, display_list\r\n\r\ngraph = {}\r\nadd_edge_list(graph, 1, 2)\r\ndisplay_list(graph)\r\n```\r\n## 3.Trie (Prefix Tree)\r\nA trie is a tree used for storing strings in a way that allows for fast retrieval of prefixes.\r\n```bash\r\nfrom bigdata_lib.trie_structure import Trie, TrieNode\r\n\r\ntrie = Trie()\r\ntrie.insert(\"example\")\r\nprint(trie.search(\"example\")) # Output: True\r\nprint(trie.search(\"test\")) # Output: False\r\n```\r\n\r\n## 4.Segment Tree\r\nA segment tree is used for storing intervals or segments, allowing efficient querying and updating.\r\n```bash\r\nfrom bigdata_lib.segment_tree import SegmentTree\r\n\r\narr = [1, 3, 5, 7, 9, 11]\r\nsegment_tree = SegmentTree(arr)\r\nprint(segment_tree.query(1, 3)) # Output: 15\r\nsegment_tree.update(1, 10)\r\nprint(segment_tree.query(1, 3)) # Output: 22\r\n```\r\n\r\n## 5.Fenwick Tree (Binary Indexed Tree)\r\nA Fenwick Tree is used for efficient range queries and updates.\r\n```bash\r\nfrom bigdata_lib.fenwick_tree import FenwickTree\r\n\r\narr = [1, 3, 5, 7, 9, 11]\r\nfenwick_tree = FenwickTree(arr)\r\nprint(fenwick_tree.query(3)) # Output: 16\r\nfenwick_tree.update(1, 10)\r\nprint(fenwick_tree.query(3)) # Output: 26\r\n```\r\n\r\n## 6.Red-Black Tree\r\nA Red-Black Tree is a self-balancing binary search tree with specific rules to ensure balanced height.\r\n```bash\r\nfrom bigdata_lib.red_black_tree import RedBlackTree\r\n\r\nrb_tree = RedBlackTree()\r\nrb_tree.insert(10)\r\nrb_tree.insert(20)\r\nrb_tree.insert(15)\r\n# Implement traversal or other operations as needed\r\n```\r\n\r\n## 7.AVL Tree\r\nAn AVL Tree is a self-balancing binary search tree where the height difference between left and right subtrees is maintained.\r\n```bash\r\nfrom bigdata_lib.avl_tree import AVLTree\r\n\r\navl_tree = AVLTree()\r\nroot = None\r\nroot = avl_tree.insert(root, 10)\r\nroot = avl_tree.insert(root, 20)\r\nroot = avl_tree.insert(root, 15)\r\n# Implement traversal or other operations as needed\r\n```\r\n\r\n## 8.Skip List\r\nA Skip List is a probabilistic data structure that allows fast search, insertion, and deletion operations.\r\n```bash\r\nfrom bigdata_lib.skip_list import SkipList\r\n\r\nskip_list = SkipList(max_level=3, p=0.5)\r\nskip_list.insert(3)\r\nskip_list.insert(6)\r\nskip_list.insert(7)\r\nprint(skip_list.search(6)) # Output: True\r\nprint(skip_list.search(4)) # Output: False\r\n```\r\n\r\n## 9.B-Tree\r\nA B-Tree is a balanced tree used for efficient data retrieval and insertion, often used in database systems.\r\n```bash\r\nfrom bigdata_lib.b_tree import BTree\r\n\r\nb_tree = BTree(t=2)\r\nb_tree.insert(10)\r\nb_tree.insert(20)\r\nb_tree.insert(5)\r\n# Implement traversal or other operations as needed\r\n```\r\n\r\n## 10.B+ Tree\r\nA B+ Tree is similar to a B-Tree but with all values stored in leaf nodes, allowing efficient range queries.\r\n```bash\r\nfrom bigdata_lib.bplus_tree import BPlusTree\r\n\r\nbplus_tree = BPlusTree(t=2)\r\nbplus_tree.insert(10)\r\nbplus_tree.insert(20)\r\nbplus_tree.insert(5)\r\n# Implement traversal or other operations as needed\r\n```\r\n\r\n# Contributing\r\nContributions are welcome! Please submit a pull request or open an issue to suggest improvements.\r\n\r\n# License\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for various big data structures including graphs, trees, and more.",
"version": "0.2",
"project_urls": {
"Homepage": "https://github.com/AdityaSrivastavDS/bigdata_lib"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "35494ba1fea2b93cadfbb4f0a9f4e73c40f23e4642bed3be63d3af5967004650",
"md5": "f4d4b1c64ebb6e2ece8a9a62a1ad23d8",
"sha256": "7bc1cc031a32c34b73349c152f4d0564e5f0502a09a53c78673464119f998495"
},
"downloads": -1,
"filename": "bigdata_lib-0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f4d4b1c64ebb6e2ece8a9a62a1ad23d8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8363,
"upload_time": "2024-09-14T18:35:15",
"upload_time_iso_8601": "2024-09-14T18:35:15.354750Z",
"url": "https://files.pythonhosted.org/packages/35/49/4ba1fea2b93cadfbb4f0a9f4e73c40f23e4642bed3be63d3af5967004650/bigdata_lib-0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ad8ae06ef09888880fd8bf36e66893bdc13920708fa0846bb2b45340636da18f",
"md5": "af1b97f4622fb7874151840a8b366908",
"sha256": "163d31655985f4e5286cc026ec6e9b9669249a02f3a4ef1db22176a8397d1831"
},
"downloads": -1,
"filename": "bigdata_lib-0.2.tar.gz",
"has_sig": false,
"md5_digest": "af1b97f4622fb7874151840a8b366908",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7472,
"upload_time": "2024-09-14T18:35:17",
"upload_time_iso_8601": "2024-09-14T18:35:17.844174Z",
"url": "https://files.pythonhosted.org/packages/ad/8a/e06ef09888880fd8bf36e66893bdc13920708fa0846bb2b45340636da18f/bigdata_lib-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-14 18:35:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AdityaSrivastavDS",
"github_project": "bigdata_lib",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bigdata-lib"
}