edges – A generator of triples of the form (u, v, d), where (u,
v) is the edge being explored in the depth-first search and d
is one of the strings ‘forward’, ‘nontree’, or ‘reverse’. A
‘forward’ edge is one in which u has been visited but v has
not. A ‘nontree’ edge is one in which both u and v have been
visited but the edge is not in the DFS tree. A ‘reverse’ edge is
on in which both u and v have been visited and the edge is in
the DFS tree.

Return type:

generator

Examples

The labels reveal the complete transcript of the depth-first search
algorithm in more detail than, for example, dfs_edges():

If a source is not specified then a source is chosen arbitrarily and
repeatedly until all components in the graph are searched.

The implementation of this function is adapted from David Eppstein’s
depth-first search function in PADS, with modifications
to allow depth limits based on the Wikipedia article
“Depth-limited search”.