Nov 17
2014

Graphing in JavaScript

JavaScript libraries which draw graphs (i.e. nodes connected by edges) seem generally to be pretty bad, perhaps because graphing is such an interestingly mathematical subject. It’s easy to get lost in coming up with the perfect data structure, picking the right automatic-layout algorithm (will it be based on a sort of atomic-repulsion thing? Will the edges have springs? Okay, but how much should they spring?), and so on, and thus so easy to forget about things like compatibility and documentation. One library I encountered seemed basically an excuse to show off a particularly interesting layout algorithm.

Anyway, after trying a few, I settled on vis.js. The example worked, which is always a good sign, it doesn’t have any obvious bugs (such as constant 100% CPU usage), and, most importantly, if you make your nodes smiley faces you can end up with some interesting sea-creature-looking things.