Adds basic comments and error checking to graph.js.
Adds further comments to graph.js.
Corrects bug in graph.js error checking.

Improves node.js comments.