def dfs_edges(G, start, depth_limit=1, get_only=True, get_path=False):
    """Deepest first search."""
    depth_limit = depth_limit - 1

    # creates unsigned int array (2 Byte)
    output_nodes = array('L')
    output_depth = array('I')
    # creates float array (4 Byte)
    output_weights = array('f')
    apath = []

    if G.node.get(start) is None:
        # raise KeyError('Start node not found')
        print('Start node not found')
        return output_nodes, output_weights, output_depth, apath

    visited = set()
    visited.add(start)

    # Save the start node with its data to the stack
    stack = [(start, G.edges_iter(start, data=True), 1.0)]
    visited.add(start)
    while stack:
        if len(output_nodes) > 80100100:
            print("To many nodes for: {}".format(start))
            del output_nodes
            del output_weights
            del output_depth
            output_nodes = array('L')
            output_depth = array('I')
            # creates float array (4 Byte)
            output_weights = array('f')
            gc.collect()
            break
        parent, children, weight = stack[-1]
        try:
            parent_, child, child_keys = next(children)
            # print "child: {}, parent_data: {}".format(child, parent_data)
            if child not in visited:
                weight = child_keys.get('weight', 1.0) * weight
                visited.add(child)

                if len(stack) >= depth_limit or weight <= 0.00001:
                    visited.remove(child)
                else:
                    stack.append((child, G.edges_iter(child, data=True),
                                 weight))

                # if its not and user.
                if get_only and child > 100000000000:
                    # if get_only and G.node[child].get('Type') != get_only:
                    continue

                output_nodes.append(child)
                output_weights.append(weight)
                output_depth.append(len(stack))
                if get_path:
                    apath.append([step[0] for step in stack])
        except StopIteration:
            stack.pop()
            visited.remove(parent)
            # if data.get('Type') == "Node":

    return output_nodes, output_weights, output_depth, apath
Deepest first search.