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.3.tar.gz (206.0 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.3-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

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

Hashes for mywheel-0.3.tar.gz
Algorithm Hash digest
SHA256 ab315816cf8707f08346fc00717adebcaee2fa734e3fdf24cec7d447c28220ee
MD5 76c43287283f722597850e99a054669a
BLAKE2b-256 8ddace4ed5002e246fd5ba437045f526e1ea869383ca2e56df1b9d744c1fb2d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mywheel-0.3.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.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

Hashes for mywheel-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 90cbcb9205156aedbc412d765cb666db63b6fd6a852d70189e587f7c4a66762c
MD5 bc592924db9b66d1abba9ed223111592
BLAKE2b-256 d6b00d23797bb5ae0e49377eb0f6761a9a25bcecd395191dcb1502ef4996eaca

See more details on using hashes here.

Provenance

The following attestation bundles were made for mywheel-0.3-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