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

Uploaded Python 3

File details

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

File metadata

  • Download URL: onestepx-0.3.5.tar.gz
  • Upload date:
  • Size: 3.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.5.tar.gz
Algorithm Hash digest
SHA256 59affede7b0d560b4aca5bc8ed06f803562b637adde13fcb5e8d512a4f8852f2
MD5 6e1dcb1ae85764ce6a55c41d17d7abb5
BLAKE2b-256 549f95b8b3ebdace8420ee8df474bcbdb567ae260c151aa10410b8e6fcc1591d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onestepx-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b0fd93453895bf6cc869a3a5949e624b98ef236c56b66d372ffd0bdf84b3acf7
MD5 934d37b15bada432f12be48599ce333b
BLAKE2b-256 d907c82d7051191d388547f9b892b87040eb562773e4d8281a27449179895eed

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