A collection of Python data structures for educational purposes
Project description
PyHelper
A comprehensive library of data structures designed for learning, teaching, and practical use in computer science education and software development.
What is this?
PyHelper provides production-ready, well-tested implementations of fundamental and advanced data structures, organized by complexity:
Basic Structures - Linear Data Organization
- Linked Lists (3 types): Forward-only, bidirectional, and circular traversal patterns
- Use when: Dynamic sizing, frequent insertions/deletions, memory efficiency
Complex Structures - Non-Linear Data Organization
- Graphs (Unified + 4 specialized types): Network relationships and connectivity
- Use when: Modeling relationships, pathfinding, network analysis, dependencies
- Trees: Hierarchical parent-child structures with guaranteed properties (m = n-1)
- Use when: File systems, org charts, decision trees, taxonomies
- Skip Lists (2 types): Probabilistic balanced structures for fast sorted operations
- Use when: Sorted data with O(log n) operations without tree balancing complexity
Prerequisites
pip install networkx matplotlib pytest
Installation
Install from PyPI (Recommended)
pip install pyhelper-jkluess
After installation, import as:
import pyhelper_jkluess
# or
from pyhelper_jkluess.Complex.Trees.tree import Tree
Install from GitHub
pip install git+https://github.com/Djey8/pyhelper-jkluess.git
Install from local directory (for development)
pip install -e .
Install from local directory (regular installation)
pip install .
Quick Start
Linked List
from pyhelper_jkluess.Basic.Lists.linked_list import LinkedList
ll = LinkedList()
ll.append(10)
ll.append(20)
ll.print_list() # 10 -> 20 -> None
Graph (Unified Class - Recommended)
from pyhelper_jkluess.Complex.Graphs.graph import Graph
# Create any graph type with parameters
g = Graph(directed=False, weighted=True)
g.add_edge("A", "B", 10)
g.add_edge("A", "C", 2)
g.add_edge("C", "B", 1)
# Find shortest path (uses Dijkstra for weighted graphs)
path, distance = g.find_shortest_path("A", "B")
print(f"Path: {path}, Distance: {distance}") # Path: ['A', 'C', 'B'], Distance: 3
# Export/import adjacency list
adj_list = g.get_adjacency_list()
g2 = Graph(directed=False, weighted=True, data=adj_list)
# Visualize
g.visualize() # Opens matplotlib window
Tree
from pyhelper_jkluess.Complex.Trees.tree import Tree
# Create tree with root
tree = Tree("Root")
# Add children
child_a = tree.add_child(tree.root, "A")
child_b = tree.add_child(tree.root, "B")
tree.add_child(child_a, "A1")
tree.add_child(child_a, "A2")
# Print structure
tree.print_tree()
# Traversals
print(tree.traverse_preorder()) # ['Root', 'A', 'A1', 'A2', 'B']
print(tree.traverse_levelorder()) # ['Root', 'A', 'B', 'A1', 'A2']
# Statistics
stats = tree.get_statistics()
print(f"Nodes: {stats['node_count']}, Height: {stats['height']}")
Skip List
from pyhelper_jkluess.Complex.SkipLists.probabilisticskiplist import ProbabilisticSkipList
sl = ProbabilisticSkipList()
sl.add(10)
sl.add(20)
print(sl.find(10)) # 10
Project Structure
pyhelper-jkluess/ # Repository root
├── pyhelper_jkluess/ # Main package (import as: import pyhelper_jkluess)
│ ├── Basic/ # Linear structures: Lists (Linked, Double, Circular)
│ │ └── Lists/ # Production-ready list implementations
│ └── Complex/ # Non-linear & advanced structures
│ ├── Graphs/ # Network structures (Unified Graph + 4 types)
│ ├── Trees/ # Hierarchical structures (Tree, Node)
│ └── SkipLists/ # Probabilistic structures (2 types)
└── tests/ # 564 comprehensive tests
Documentation by Data Structure Category
Linear Structures
- Basic Lists - LinkedList, DoubleLinkedList, CircularLinkedList
- Forward-only, bidirectional, and circular traversal patterns
- When to use: Dynamic arrays, LRU caches, round-robin scheduling
Non-Linear Structures
-
Graphs - Unified Graph + 4 specialized types
- Unified Architecture: Single
Graphclass adapts to all 4 types (64% code reduction) - Graph Theory: Paths, cycles, connectivity, shortest paths (BFS/Dijkstra)
- Representations: Adjacency matrices and lists (import/export)
- When to use: Network modeling, dependencies, social networks, routing
- Unified Architecture: Single
-
Trees - Tree with 39 operations
- Properties: m = n-1 edges, connected, acyclic, unique paths between nodes
- Traversals: Preorder, inorder, postorder, level-order
- Features: Depth/height, ancestors/descendants, adjacency matrix/list support
- When to use: Hierarchies, file systems, decision trees, taxonomies
-
Skip Lists - Deterministic & Probabilistic
- Performance: O(log n) operations with probabilistic balancing
- Types: Key-value store (SkipList) and sorted set (ProbabilisticSkipList)
- When to use: Sorted data without complex tree balancing
Testing
pytest tests/ -v # 564 comprehensive tests
Contributing
We use automated semantic versioning with conventional commits. See:
- Quick Start CI/CD Guide - Fast introduction to contributing
- Development Guide - Detailed CI/CD and versioning documentation
Quick Contribution Guide
- Fork and clone the repository
- Create a feature branch from
develop - Use conventional commits:
feat:for new features (minor version bump)fix:for bug fixes (patch version bump)docs:for documentation
- Push and create PR to
develop - Merge to
maintriggers automatic release and PyPI publish
Example:
git checkout -b feature/add-hash-table develop
git commit -m "feat(structures): add hash table implementation"
git commit -m "test(structures): add hash table tests"
git push origin feature/add-hash-table
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyhelper_jkluess-1.1.0.tar.gz.
File metadata
- Download URL: pyhelper_jkluess-1.1.0.tar.gz
- Upload date:
- Size: 69.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cfc8f2d6e7a48b17ab70cb8a50ea68e1f23865b0d071bb89121ef7130bdf77c
|
|
| MD5 |
4146eb240f47a84c0b5dd20195d61b40
|
|
| BLAKE2b-256 |
b5febaf716e28d002e47ab75fb8104f75f6dc0f411211aef2a52e2d14f97679c
|
File details
Details for the file pyhelper_jkluess-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pyhelper_jkluess-1.1.0-py3-none-any.whl
- Upload date:
- Size: 84.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9b0b1c09f9ffd7b53f8a82c06ff53ef994a5559b014497eedfcdaabb74b88b3
|
|
| MD5 |
5924a10cba3e8b0939875fd106fd82c2
|
|
| BLAKE2b-256 |
2e25656115620f7e580f6c26f2a25f931dc87f7cbb47eaab1bc5dfe11bc1f829
|