added special cases for graph traversal