Check if `traversal == 'dfs'` and raise an `nx.NetworkXError` if not.