Python implementations of depth-first-search and breadth-first-search