Slashdot Mirror


Visualizing Algorithms

An anonymous reader writes "Many people reading this site probably have a functional understanding of how algorithms work. But whether you know algorithms down to highly mathematical abstractions or simple as a fuzzy series of steps that transform input into output, it can be helpful to visualize what's going on under the hood. That's what Mike Bostock has done in a new article. He walks through algorithms for sampling, shuffling, and maze generation, using beautiful and fascinating visualizations to show how each algorithm works and how it differs from other options.

He says, "I find watching algorithms endlessly fascinating, even mesmerizing. Particularly so when randomness is involved. ... Being able to see what your code is doing can boost productivity. Visualization does not supplant the need for tests, but tests are useful primarily for detecting failure and not explaining it. Visualization can also discover unexpected behavior in your implementation, even when the output looks correct. ...Even if you just want to learn for yourself, visualization can be a great way to gain deep understanding. Teaching is one of the most effective ways of learning, and implementing a visualization is like teaching yourself."

10 of 50 comments (clear)

  1. Beautiful and fascinating by yorgo · · Score: 2

    Wonderful stuff. Reminded me of this site: http://www.informationisbeauti... (beautiful ways to view typically boring stuff).

  2. Visualize by Bengie · · Score: 2

    I've always visualized what's going on, this is how I do everything. Doesn't everyone program this way? Think about something for a while, building up the model in your head, then visualize the interactions among the parts. If the problem is too complex to visualize, then I simplify and add abstractions until I can visualize it. This iteration naturally creates simplified abstract layers in my code.

    I debug most of my code this way also. When I'm internally visualizing stuff, I lose track of what's going on around me. I wouldn't be surprised if a brainscan would show activity in my visual cortex.

    1. Re:Visualize by Anonymous Coward · · Score: 2, Interesting

      First the light is, and then I see the yarns and the strings that link them. Then the strings start vibrating and I can hear them talk to each other. Then I hear the races in the polyphony and I reach my arms out to the strings. I sip from the source and smell the algorithms. It is only then that the notes come to my fingers.

  3. 15 Sorting Algorithms in 6 Minutes by Anonymous Coward · · Score: 2, Interesting

    https://www.youtube.com/watch?v=kPRA0W1kECg

  4. A great book for learing D3.js by nullchar · · Score: 2

    I'm not affiliated with the author in any way, but I did buy the book (though you can get it for free).

    This is an amazing resource for someone new to D3.js's declarative javascript and helps you put it all together: https://leanpub.com/D3-Tips-an...

    After using D3.js, I've come to the conclusion Mike Bostock is awesome! But it doesn't stop there, people have expanded it like Crossfilter and dc.js.

    Tech that allows a javascript n00b like myself to build a simple race results visualization.

  5. Comment removed by account_deleted · · Score: 2

    Comment removed based on user account deletion

  6. Re:The book is always better than the movie by ebyrob · · Score: 2

    Actually, after reading the article, I'd call what he's doing extremely good basic engineering and model design/view. It's very cool for the problems he presents, but looks like a ton of work. To be generally useful, it seems he'd have to come up with rules of thumb and generalizations for what it is typically important to see/understand in a given algorithm and a way to identify *what* to model/visualize that isn't completely subjective.

    He appears to make some great subjective decisions on what/how to do things, the problem in general is many developers are poor in certain subjective areas. The real gem will be how to reduce some of the less useful subjectivity and turn it into things that are more objective and better subjectively through practice of useful rules and guidelines.

    Consuming this stuff is really just letting another engineer do the heavy lifting FOR you. ... like watching a movie and letting Hollywood do the imagining FOR you...

    I mean, this is a great movie, don't get me wrong, I'm just glad I read the book first.

  7. Re:Pretty, but misleading. by UnknownSoldier · · Score: 2

    This is total nonsense.

    Algorithms are first _designed_ BY humans. Algorithms can be _optimized_ FOR computers.

    Visualization is a way to augment understanding, not replace it.

    There are 4 primary ways of learning:

    * visual,
    * auditory,
    * kinesthetic, and
    * mental.

    Students have various ways that work "best" FOR THEM. Saying visualization is dangerous shows your ignorance about the subject. If you had seen the excellent move Temple Grandin you would understand that not everyone thinks the same way.

  8. Visualization for evaluating randomness by Lorens · · Score: 2

    Visualization is also great for evaluating randomness; remember the images of broken RNG implementations a few years ago? http://lcamtuf.coredump.cx/new...

  9. See also: Data Structure Visualizations by Paul+Fernhout · · Score: 2

    More fundamental CS though: http://www.cs.usfca.edu/~galle...

    --
    A 21st century issue: the irony of technologies of abundance in the hands of those still thinking in terms of scarcity.