Javascript Directed Graph