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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pd_code_components-0.1.1.tar.gz.
File metadata
- Download URL: pd_code_components-0.1.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.11.15 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c7525afa88f7720b24527bd5dc28beab61ac33cee37d59aad01305276e8692d
|
|
| MD5 |
1fb577976e1b90ef7fe069d6fe9cd30f
|
|
| BLAKE2b-256 |
0c73be2f35d565296341319bb834f600f2e8a650425ee0a3ac6933a605f6bd25
|
File details
Details for the file pd_code_components-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pd_code_components-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.11.15 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95dc951e6717eaa94f1541d9099884c06557b34b1bd1b7e5cfce0fd9ef391b50
|
|
| MD5 |
8993afcbbf5c0736b343b22f8e57caa4
|
|
| BLAKE2b-256 |
7a7508992ecb650cc1fc4f02ebae41ef3f3ba5096d93774b84c990bd690d76af
|