def edge_dfs(G, source=None, orientation='original'):
 nodes = list(G.nbunch_iter(source))
 if (not nodes):
  raise StopIteration
 kwds = {'data': False}
 if G.is_multigraph():
  kwds['keys'] = True
 (out_edges, key, tailhead) = helper_funcs(G, orientation)
 visited_edges = set()
 visited_nodes = set()
 edges = {}
 for start_node in nodes:
  stack = [start_node]
  while stack:
   current_node = stack[(-1)]
   if (current_node not in visited_nodes):
    edges[current_node] = out_edges(current_node, **kwds)
    visited_nodes.add(current_node)
   try:
    edge = next(edges[current_node])
   except StopIteration:
    stack.pop()
   else:
    edge_key = key(edge)
    if (edge_key not in visited_edges):
     visited_edges.add(edge_key)
     stack.append(tailhead(edge)[1])
     (yield edge)

def edge_dfs ( G , source = None , orientation = 'original' ) : nodes = list ( G . nbunch_iter ( source ) ) if ( not nodes ) : raise StopIteration kwds = { 'data' : False } if G . is_multigraph ( ) : kwds [ 'keys' ] = True ( out_edges , key , tailhead ) = helper_funcs ( G , orientation ) visited_edges = set ( ) visited_nodes = set ( ) edges = { } for start_node in nodes : stack = [ start_node ] while stack : current_node = stack [ ( - 1 ) ] if ( current_node not in visited_nodes ) : edges [ current_node ] = out_edges ( current_node , ** kwds ) visited_nodes . add ( current_node ) try : edge = next ( edges [ current_node ] ) except StopIteration : stack . pop ( ) else : edge_key = key ( edge ) if ( edge_key not in visited_edges ) : visited_edges . add ( edge_key ) stack . append ( tailhead ( edge ) [ 1 ] ) ( yield edge )
a directed .