Skip to main content

Network Optimization Python Code

Project description

Python Version PyPI-Server Project generated with PyScaffold Documentation Status Coverage Status License

logo

🛞 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mywheel-0.4.tar.gz (79.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mywheel-0.4-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file mywheel-0.4.tar.gz.

File metadata

  • Download URL: mywheel-0.4.tar.gz
  • Upload date:
  • Size: 79.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mywheel-0.4.tar.gz
Algorithm Hash digest
SHA256 0d2f6a5de35995e7c6f83c436f2055da1686b0ba70700c7500e8610ebf040889
MD5 36a326662aa4c9220a0d98aa499c9355
BLAKE2b-256 fd96c81fcd3aac28f0c35ca09934fc2afca8be8f7f78c564b57b0b448608c3b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mywheel-0.4.tar.gz:

Publisher: python-publish.yml on luk036/mywheel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mywheel-0.4-py3-none-any.whl.

File metadata

  • Download URL: mywheel-0.4-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mywheel-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f47648cbb4083bd335703cb8fd710b66ef78e660fffda05f8f7ffc2c71cbe3e2
MD5 acbe790031525117beb685cc9fbc2e45
BLAKE2b-256 0bc93465f56ca2f55c5fd3f7bde4ef9aa46aa12952fd55697fdd892adc0ca728

See more details on using hashes here.

Provenance

The following attestation bundles were made for mywheel-0.4-py3-none-any.whl:

Publisher: python-publish.yml on luk036/mywheel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page