Network Optimization Python Code
Project description
🛞 mywheel
High-performance data structures and algorithms in Python
mywheel provides efficient implementations of fundamental data structures optimized for specific use cases in graph algorithms, EDA (Electronic Design Automation), and network optimization. All implementations prioritize memory efficiency and time complexity over Python's standard library alternatives.
🚀 Quick Start
Installation
pip install mywheel
Usage Examples
Doubly Linked List with O(1) Operations
from mywheel import Dllist, Dllink
# Create list
dlist = Dllist(0) # sentinel node
dlist.append(Dllink("A"))
dlist.append(Dllink("B"))
# O(1) operations
node = dlist.popleft() # Remove first
dlist.appendleft(Dllink("C")) # Add to front
Bounded Priority Queue for Small Integer Keys
from mywheel import BPQueue, Dllink
# Efficient for keys in range [-5, 5]
bpq = BPQueue(-5, 5)
# Add items with integer keys
bpq.append(Dllink("task1"), 3)
bpq.append(Dllink("task2"), 5)
# Extract highest priority item
item = bpq.popleft()
Round-Robin Iteration
from mywheel import Robin
# Create 5-part cycle
robin = Robin(5)
# Iterate excluding starting position
for part in robin.exclude(2):
print(part) # Prints: 3, 4, 0, 1
Array-Like Utilities
from mywheel import MapAdapter
# Adapt list to dict-like interface
lst = [10, 20, 30, 40]
mapping = MapAdapter(lst)
mapping[0] = 99
assert mapping[0] == 99
📊 Performance Characteristics
| Data Structure | Insert | Delete | Lookup | Memory | Best For |
|---|---|---|---|---|---|
Dllist |
O(1) | O(1) | N/A | Minimal | Frequent front/back operations |
BPQueue |
O(1)* | O(k) | O(1) | O(b-a) | Small bounded integer keys |
Robin |
O(n) | N/A | O(1) | O(n) | Round-robin scheduling |
MapAdapter |
O(1) | N/A | O(1) | O(n) | Dict-like list access |
* O(1) amortized for bounded keys
🎯 Used In
- digraphx - Graph algorithms and data structures
- netlistx - VLSI netlist partitioning
- ckpttnpy - Multi-level circuit partitioning
✨ Features
- Memory Efficient: Uses
__slots__and sentinel nodes to minimize overhead - Type Safe: Full type hints with mypy support
- Well Tested: 100% coverage with pytest and hypothesis
- Zero Dependencies: Pure Python, no external runtime dependencies
- Python 3.8+: Supports all modern Python versions
🔧 Development
# Clone and install
git clone https://github.com/luk036/mywheel.git
cd mywheel
pip install -e ".[testing]"
# Run tests
pytest
# Run type checking
mypy src/mywheel
# Run linting
pre-commit run --all-files
See CONTRIBUTING.md for detailed guidelines.
👉 Note
This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.
Project details
Release history Release notifications | RSS feed
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 mywheel-0.3.tar.gz.
File metadata
- Download URL: mywheel-0.3.tar.gz
- Upload date:
- Size: 206.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab315816cf8707f08346fc00717adebcaee2fa734e3fdf24cec7d447c28220ee
|
|
| MD5 |
76c43287283f722597850e99a054669a
|
|
| BLAKE2b-256 |
8ddace4ed5002e246fd5ba437045f526e1ea869383ca2e56df1b9d744c1fb2d7
|
Provenance
The following attestation bundles were made for mywheel-0.3.tar.gz:
Publisher:
python-publish.yml on luk036/mywheel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mywheel-0.3.tar.gz -
Subject digest:
ab315816cf8707f08346fc00717adebcaee2fa734e3fdf24cec7d447c28220ee - Sigstore transparency entry: 1677902229
- Sigstore integration time:
-
Permalink:
luk036/mywheel@6a6c5b51409bd351fedf1073b7805f0739028314 -
Branch / Tag:
refs/tags/0.3 - Owner: https://github.com/luk036
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6a6c5b51409bd351fedf1073b7805f0739028314 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mywheel-0.3-py3-none-any.whl.
File metadata
- Download URL: mywheel-0.3-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90cbcb9205156aedbc412d765cb666db63b6fd6a852d70189e587f7c4a66762c
|
|
| MD5 |
bc592924db9b66d1abba9ed223111592
|
|
| BLAKE2b-256 |
d6b00d23797bb5ae0e49377eb0f6761a9a25bcecd395191dcb1502ef4996eaca
|
Provenance
The following attestation bundles were made for mywheel-0.3-py3-none-any.whl:
Publisher:
python-publish.yml on luk036/mywheel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mywheel-0.3-py3-none-any.whl -
Subject digest:
90cbcb9205156aedbc412d765cb666db63b6fd6a852d70189e587f7c4a66762c - Sigstore transparency entry: 1677902335
- Sigstore integration time:
-
Permalink:
luk036/mywheel@6a6c5b51409bd351fedf1073b7805f0739028314 -
Branch / Tag:
refs/tags/0.3 - Owner: https://github.com/luk036
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6a6c5b51409bd351fedf1073b7805f0739028314 -
Trigger Event:
release
-
Statement type: