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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pd_code_connected_sum-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pd_code_connected_sum-0.1.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pd_code_connected_sum-0.1.1.tar.gz.

File metadata

  • Download URL: pd_code_connected_sum-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Windows/10

File hashes

Hashes for pd_code_connected_sum-0.1.1.tar.gz
Algorithm Hash digest
SHA256 97e85a4404a32438b42b8fab197cf8df9dd71710ad2d45fabc9c609b802d7b8d
MD5 b8390e52341ce6f73ff224dbe8f272be
BLAKE2b-256 323246b2947445299996c8ff54255c939eda02ea5c0c6d9b3d8e50c7b356d7e1

See more details on using hashes here.

File details

Details for the file pd_code_connected_sum-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pd_code_connected_sum-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95b80fc4d9e072ca3765a16eeb440c153346d76754258e93dde9fa1e85eb8500
MD5 30edab4e4cdf7aac0bb82eb59d2713d1
BLAKE2b-256 61e8e51be6b97f150efcb3440074001a1586b1f28a9cd8c7d3c35f14e8dccc4c

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 Sentry Error logging StatusPage Status page