Skip to content

FIX: Stable degeneracy#801

Closed
nkeim wants to merge 3 commits into
soft-matter:masterfrom
nkeim:stable-degeneracy
Closed

FIX: Stable degeneracy#801
nkeim wants to merge 3 commits into
soft-matter:masterfrom
nkeim:stable-degeneracy

Conversation

@nkeim
Copy link
Copy Markdown
Contributor

@nkeim nkeim commented May 4, 2026

This resolves #776 in most if not all cases, by making the order of a set of Point objects non-random.

While the order of a set is never guaranteed, it is based on the objects' hash values. Starting with Python 3.3 these hashes were randomized as a security measure. This issue was causing repeated linking runs to resolve degenerate cases randomly, even within the same session. This PR makes Python use the Point's uuid attribute (basically, its serial number) instead.

This PR adds tests to make sure that degenerate linking cases (with and without memory) always resolve the same way within the same session. It does not ensure that results are consistent across linkers or across sessions. (It turns out this requires a change to the linking algorithm itself, so it will be a separate PR.)

@nkeim
Copy link
Copy Markdown
Contributor Author

nkeim commented May 4, 2026

I should note that besides fixing the issues with GitHub actions, it's important to evaluate the effect of this PR on performance. It's easy to see how using a custom hash could dramatically slow down linking. I would love for someone to check this with their own data!

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.

memory not stable between runs

1 participant