The order of growth for graph algorithms is usually expressed as a function of n, the number of vertices (nodes), and m, the number of edges. If the node is not already in seen, we add it, which is co...The order of growth for graph algorithms is usually expressed as a function of n, the number of vertices (nodes), and m, the number of edges. If the node is not already in seen, we add it, which is constant time, and then add the neighbors to the stack, which is linear in the number of neighbors. To express the run time in terms of n and m, we can add up the total number of times each node is added to seen and stack.