Skip to main content

Instant hierarchical collapse to terminal node (O(1) traversal)

Project description

OneStep

Instant hierarchical collapse — from O(N) traversal to O(1) constant time.


What is it?

OneStep implements the OneStep search model: pre‑collapse any hierarchy to a single terminal representation T so that predicates operate on T instead of traversing nodes.

Formally, for a predicate P over nodes, OneStep defines a lifted predicate P^# acting on the terminal object T, so queries are constant‑time:

Q(v, P) = P^#(T)

Install

pip install onestep

(or build from source with python -m build and pip install dist/*.whl)

Quick Start

from onestep import collapse_to_terminal, TERMINAL
from onestep.hierarchy import Node

root = Node("Root")
root.add_child(Node("Child"))
t = collapse_to_terminal(root)
assert t is TERMINAL
print(t)  # Terminal

CLI

onestep --demo

Why O(1)?

The pre‑collapse phase is a one‑time cost when data changes. Queries apply to the terminal object T only; they no longer depend on the size of the hierarchy.

License

MIT © 2025 Your Name

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

onestepx-0.3.6.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

onestepx-0.3.6-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file onestepx-0.3.6.tar.gz.

File metadata

  • Download URL: onestepx-0.3.6.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for onestepx-0.3.6.tar.gz
Algorithm Hash digest
SHA256 c4dadf7692f73039fcb91bb92cd017fc78b99628b588f633ae937fb5b404bcfd
MD5 f87cef8ebe1ee6d07e60af41ae8ab0f7
BLAKE2b-256 be5a2011738ee9b281d9c2453c834d3b5805980a4629dafc14a4801028562b0e

See more details on using hashes here.

File details

Details for the file onestepx-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: onestepx-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for onestepx-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 937d9a471c83e5a54173d990f81368e1d08a1151da5a8c5471744c49a1717bb2
MD5 c947581b5189391e9baf6600eaff59cf
BLAKE2b-256 6cfbbb008475a89fee237b3a776fa8fad57471bc7dc6445c05c29a65e6035ae0

See more details on using hashes here.

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