Fix depth limited searches in `ancestors` and `descendants` methods.

The `ancestors` and `descendants` were missing some nodes when working with limited generations; use breadth-first search instead of depth-first to fix this.

Fixes #30.