Move graph algorithms into graph.js.