pseudocode added to traverse graph in graph.js