Skip to main content

pd-code-components

Find the components represented by a planar-diagram code.

Installation

pip install pd-code-components

Usage example

from pd_code_components import get_components_from_pd_code

hopf = [[2, 3, 1, 4], [4, 1, 3, 2]]
print(get_components_from_pd_code(hopf))
# [[1, 2], [3, 4]]

Algorithm

At each crossing, slots 0 and 2 belong to one strand and slots 1 and 3 to the other. These opposite-slot pairs form an undirected graph on arc labels. Iterative depth-first traversal finds connected components in O(V + E) time. Sets are used for adjacency and visitation, avoiding the quadratic membership checks in the original list-based implementation.

Input conventions

A PD code is represented as a list of four-entry crossings. Arc labels normally occur exactly twice. Public functions validate inputs and return new values rather than mutating caller-owned data unless their API explicitly says otherwise.

External software

No external software is required.

Development

Run examples and package checks before release. Python packages require Python 3.10 or newer. Build PyPI artifacts with:

poetry check
poetry build

License

MIT. See LICENSE.

Metadata

Release files for pd-code-components 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pd-code-components 0.1.1
File Size Uploaded
pd_code_components-0.1.1.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pd-code-components 0.1.1
File Interpreter ABI Platform
pd_code_components-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / pd_code_components-0.1.1.tar.gz

Download URL pd_code_components-0.1.1.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7c7525afa88f7720b24527bd5dc28beab61ac33cee37d59aad01305276e8692d
BLAKE2b-256 checksum
How to use checksums
0c73be2f35d565296341319bb834f600f2e8a650425ee0a3ac6933a605f6bd25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Windows/10

Release files / pd_code_components-0.1.1-py3-none-any.whl

Download URL pd_code_components-0.1.1-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95dc951e6717eaa94f1541d9099884c06557b34b1bd1b7e5cfce0fd9ef391b50
BLAKE2b-256 checksum
How to use checksums
7a7508992ecb650cc1fc4f02ebae41ef3f3ba5096d93774b84c990bd690d76af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Windows/10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page