first version of graph traversal algorithm implemented; still buggy