Adding definition for graph traversal