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

Uploaded Python 3

File details

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

File metadata

  • Download URL: onestepx-0.3.7.tar.gz
  • Upload date:
  • Size: 5.9 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.7.tar.gz
Algorithm Hash digest
SHA256 2b62ae6de4dfe7212e0cf1e5b10270acf2c1b86285d9a263c02e82b83d192668
MD5 63094c59ecc18f7e2de8d13de70d76e5
BLAKE2b-256 f808be2cef75bae8b8fb3c43f981efdc888003d31813e515d29989018b35b2ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onestepx-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 dff0edfa170690a3602109513fb6b3870863fcd374ce823313264509bf7d4e27
MD5 0c24b8843b7ff89cc8fcd4e272770245
BLAKE2b-256 e1092f4412b49e7becab7e8020e9d79b6f690bddc0195ae9c6b974e5b8d051c5

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