rough implementations of depth first search and breadth first search