added parent attribute to graph. BFS now builds a tree.