small bits of work
from-memory dfs and bfs, which probably aren't so good