Skip to content

Fix two issues regarding the PD Code of the Link class - #42716

Draft
soehms wants to merge 4 commits into
sagemath:developfrom
soehms:normalize_pd
Draft

Fix two issues regarding the PD Code of the Link class#42716
soehms wants to merge 4 commits into
sagemath:developfrom
soehms:normalize_pd

Conversation

@soehms

@soehms soehms commented Aug 23, 2026

Copy link
Copy Markdown
Member

1. Currently, the _directions_of_edges method returns incorrect results if a link's pd_code contains loops. Example:

sage: K = Link([[1, 5, 12, 6], [6, 12, 7, 11], [9, 10, 10, 11], [8, 1, 9, 4], [7, 5, 8, 4]])
sage: K._directions_of_edges()
({12: [1, 5, 12, 6], 11: [6, 12, 7, 11], 10: [9, 10, 10, 11], 7: [6, 12, 7, 11], 8: [7, 5, 8, 4], 9: [8, 1, 9, 4], 1: [1, 5, 12, 6], 4: [8, 1, 9, 4], 5: [7, 5, 8, 4], 6: [1, 5, 12, 6]},
 {12: [6, 12, 7, 11], 11: [9, 10, 10, 11], 10: [9, 10, 10, 11], 7: [7, 5, 8, 4], 8: [8, 1, 9, 4], 9: [9, 10, 10, 11], 1: [8, 1, 9, 4], 4: [7, 5, 8, 4], 5: [1, 5, 12, 6], 6: [6, 12, 7, 11]})

Here, the crossing involving the loop [9, 10, 10, 11] appears three times as a head and only once as a tail. The implementation calculates the position of an edge within the crossing using index; however, this function never returns the second position of the 10 within the crossing.

2. The PD-Code generated from the braid and DT notations does not strictly adhere to standard conventions (such as those explained at KnotInfo).

This poses a problem when these PD-Codes are used as input for other programs (such as Khoca) that implicitly assume that consecutive segments of a component are labeled with consecutive numbers.

The following is implemented

  1. A new public method components, which explicitly returns the components of a link as lists of edge labels derived from the PD code.
  2. This method is used for a new implementation of _directions_of_edges which fixes the first issue, in number_of_components as well as in two new internal methods (_is_pd_normalized and _normalize_pd), which assist in calculating a normalized PD code of a link given in braid or DT notation.
  3. A warning is added in __init__ to alert the user to non-normalized PD inputs.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

soehms added 2 commits August 22, 2026 15:34
implements new methods components,  _normalize_pd and  _is_pd_normalized.
Furthermore, it rewrites _directions_of_edges
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

Documentation preview for this PR (built with commit 99bc0ca; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant