Skip to content

Add IsParadoxical and IsKParadoxical for tournaments - #947

Open
William-Kenyon wants to merge 6 commits into
digraphs:mainfrom
William-Kenyon:fix-issue-942
Open

William-Kenyon wants to merge 6 commits into
digraphs:mainfrom
William-Kenyon:fix-issue-942

Conversation

@William-Kenyon

Copy link
Copy Markdown

Fixes #942, for checking if a tournament is paradoxical (every vertex has an in-neighbour), or more generally if it is k-paradoxical (every set of k vertices has a common in-neighbor).

Notes:

  • The algorithm for IsKParadoxical(D, k) is brute-force: it checks every subset of size k for a common in-neighbour using list intersection, which has complexity O((n choose k) * k * n) where n is the number of vertices of D.
  • I went with the convention that if D has no vertices, then regardless of k, it is not paradoxical, though I don't have any reason for/against the convention.
  • Alternatively, if D has vertices but k is 0, then it is considered paradoxical, to not break the pattern that being k-paradoxical implies being (k-1)-, (k-2)-,...-paradoxical.

I made IsParadoxical(D) a property and IsKParadoxical(D, k) an operation, but am wondering if both should be operations, IsParadoxical should be removed, or is there a better option?

A possible follow-up is to add Paley digraphs, which give a way to construct k-paradoxical tournaments (Graham, R. H., Spencer, J. H., "A Constructive Solution to a Tournament Problem").

@james-d-mitchell

Copy link
Copy Markdown
Member

@William-Kenyon can you please update so that the CI passes?

@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.45%. Comparing base (8d49e9a) to head (7a99180).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #947   +/-   ##
=======================================
  Coverage   97.45%   97.45%           
=======================================
  Files          50       50           
  Lines       21189    21237   +48     
  Branches      639      639           
=======================================
+ Hits        20649    20697   +48     
  Misses        475      475           
  Partials       65       65           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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

Labels

None yet

2 participants