# Tutorial by Examples: depth

## Nesting depth

Nesting is a very powerful feature, but should be used with caution. It can happen quite easily and quickly, that you start nesting and carry on including all children in a nest, of a nest, of a nest. Let me demonstrate: // SCSS header { // [css-rules] .holder { // [css-rules] ...

## Increasing the Maximum Recursion Depth

There is a limit to the depth of possible recursion, which depends on the Python implementation. When the limit is reached, a RuntimeError exception is raised: RuntimeError: Maximum Recursion Depth Exceeded Here's a sample of a program that would cause this error: def cursing(depth): try: ...

The traditional use of shadowing is to give 2-dimensional drawings the illusion of 3D depth. This example shows the same &quot;button&quot; with and without shadowing var canvas=document.createElement(&quot;canvas&quot;); var ctx=canvas.getContext(&quot;2d&quot;); document.body.appendChild(can...

## Detecting a cycle in a directed graph using Depth First Traversal

A cycle in a directed graph exists if there's a back edge discovered during a DFS. A back edge is an edge from a node to itself or one of the ancestors in a DFS tree. For a disconnected graph, we get a DFS forest, so you have to iterate through all vertices in the graph to find disjoint DFS trees. ...

## Introduction To Depth-First Search

Depth-first search is an algorithm for traversing or searching tree or graph data structures. One starts at the root and explores as far as possible along each branch before backtracking. A version of depth-first search was investigated in the 19th century French mathematician Charles Pierre Trémaux...

## Depth First Search

Depth First Traversal (or Search) for a graph is similar to Depth First Traversal of a tree. The only catch here is, unlike trees, graphs may contain cycles, so we may come to the same node again. To avoid processing a node more than once, we use a boolean visited array. Below algorithm presents th...

## Depth First Search traversal function

The function takes the argument of the current node index, adjacency list (stored in vector of vectors in this example), and vector of boolean to keep track of which node has been visited. void dfs(int node, vector&lt;vector&lt;int&gt;&gt;* graph, vector&lt;bool&gt;* visited) { // check whethe...

Page 1 of 1