graph: reworked traversal routines, and traversal states