Live data from Hacker News

Sorting Visualizations

imgur.com

11–20 of 38 posts

Re: Sorting Visualizations

#11

I wonder how they created this visualization?

Create a two-dimensional array of width w and height h. Fill each row of the array with the numbers 1..w randomly shuffled. Pick a sorting algorithm, implement it so that you can run it one elementary sorting step at a time and observe the partial result. For each row in your array, execute a single step of your algorithm. Store the partial result as an image, with the elements of the array interpreted as the hue component of a HSL color coordinate. Repeat until the algorithm has halted for every row in the array. Make an animation out of the resulting frames.

Re: Sorting Visualizations

#14

Mike Bostock, the author of d3.js, has a similar post in which he uses angled sticks to indicate sorting order, and also touches on some other algorithmic visualizations. https://bost.ocks.org/mike/algorithms/

Wow - those are simply amazing.

Re: Sorting Visualizations

#15
Compared to other visualization, having the extra axis dimension just means what, that the sorting is being done as if each row was an independent sort, and all rows are being sorted simultaneously?

Re: Sorting Visualizations

#16
Good stuff, except for the rainbow color scales [1]. I'd much prefer to see the same in viridis [2] or something similar. The color boundaries on the rainbow scale are not perceived uniformly by human eyes (there might even be a cultural bias at play, i.e. we may distinguish blue from green more readily than different shades of blue, even if they may be objectively at the same distance)

[1] https://visual.ly/blog/rainbow-color-scales/

[2] https://cran.r-project.org/web/packages/viridis/vignettes/in...

Edit:

Here's my demo, in Viridis: http://gph.is/2xZnKxl

(Generated in ipython + numpy + matplotlib + seaborn)

Re: Sorting Visualizations

#19

Good stuff, except for the rainbow color scales [1]. I'd much prefer to see the same in viridis [2] or something similar. The color boundaries on the rainbow scale are not perceived uniformly by human eyes (there might even be a cultural bias at play, i.e. we may distinguish blue from green more readily than different shades of blue, even if they may be objectively at the same distance) [1] https://visual.ly/blog/rai…

Nit: "distance" in color space is fiendishly difficult to define. It's not as simple as treating RGB as cartesian coordinates and computing the distance algorithm.

So, yes, everything you said, and then some.

Post reply on HN