Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hashing questionID to produce a color for a question generates color collisions for the eye #118

Open
kounkou opened this issue Nov 12, 2024 · 1 comment
Labels

Comments

@kounkou
Copy link
Owner

kounkou commented Nov 12, 2024

Description

So I have a hard problem... Or I think I do... 🥲
I am trying to generate colors for each questions for the Stats graph.
It turns out, the solution I wanted to go with is to hash the questionID, like : BFS, or DFS etc... and then generate a color based on it.
But I am getting collisions (as expected)

Acceptance criteria

  • The colors should be disctincts for the human eye
  • The color should be automatically generated (I don't want to select the color manually as the number of questions could grow...)

Example of collisions

notice how Merge Int., bfs it., 'Factorial`, ... have collisions when I hash the questionId to a 16 bits integer.

Screenshot 2024-11-11 at 4 16 00 PM

Here are collisions on a 32 bit integer hashed number binary search and Insert int. ...

Screenshot 2024-11-11 at 4 17 54 PM

Debuging infos

To confirm those are color collisions I checked what's the hue produced for 2 questionIds resulting in similar colors. Those really are collisions for the human eye. Notice the 4 points gap between bother hues

Here is the eye collision seen for Topological sort and Meeting rooms

Screenshot 2024-11-11 at 8 03 17 PM
qml: ---> questionId:  Topological sort
hash:  254168623
hue:  343

qml: ---> questionId:  Meeting rooms
hash:  780882099
hue:  339
@kounkou kounkou added hard help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Nov 12, 2024
@kounkou
Copy link
Owner Author

kounkou commented Nov 12, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant