Skip to main content

pd-code-connected-sum

Join two selected oriented PD-code components and canonically renumber the result.

Installation

pip install pd-code-connected-sum

Usage example

from pd_code_connected_sum import connected_sum

left = [[1, 5, 2, 4], [3, 1, 4, 6], [5, 3, 6, 2]]
right = [[1, 5, 2, 4], [3, 1, 4, 6], [5, 3, 6, 2]]
result, label_map = connected_sum(left, right, 1, 1)
print(result)
print(label_map["a_1"], label_map["b_1"])

Algorithm

Each input component is converted to a deterministic oriented cycle. The algorithm locates the incidence immediately after each selected arc, offsets the second code to avoid collisions, cuts those two oriented arcs, and glues the endpoints crosswise. It then canonically orders component cycles, assigns contiguous labels, orients every crossing consistently, and returns maps for all original labels. This avoids the incorrect local crossing replacement used by older releases.

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-connected-sum 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-connected-sum 0.1.1
File Size Uploaded
pd_code_connected_sum-0.1.1.tar.gz 3.4 kB Details

Built distribution (wheel)

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

Total release size: 7.7 kB

Release files / pd_code_connected_sum-0.1.1.tar.gz

Download URL pd_code_connected_sum-0.1.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
97e85a4404a32438b42b8fab197cf8df9dd71710ad2d45fabc9c609b802d7b8d
BLAKE2b-256 checksum
How to use checksums
323246b2947445299996c8ff54255c939eda02ea5c0c6d9b3d8e50c7b356d7e1
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_connected_sum-0.1.1-py3-none-any.whl

Download URL pd_code_connected_sum-0.1.1-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95b80fc4d9e072ca3765a16eeb440c153346d76754258e93dde9fa1e85eb8500
BLAKE2b-256 checksum
How to use checksums
61e8e51be6b97f150efcb3440074001a1586b1f28a9cd8c7d3c35f14e8dccc4c
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.3

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