DSA-VerseLearn by watching code run
DashboardData StructuresAlgorithmsVisualizerCORECoding PlaygroundInterview QuestionsComplexity AnalyzerLearning NotesBookmarksLearning ProgressSettings
Instrumented JavaScript implementation · lines sync with the animation

Run to execute this JavaScript code for real (output appears here).

Graph DFS (Depth-First Search)

graphs
ABCDEFG

Call stack (bottom → top)

A

Traversal order

—
Current vertexOn call stackDiscoveredFinishedUnvisited

Ready.

Goes as deep as possible along each branch before backtracking. This recursive version uses the call stack as its implicit stack. Press Run (Ctrl + Enter) to animate, or Step forward (F10) to go one event at a time.

1 / 67

Execution

Step

1 / 67

Line (JavaScript)

—

RECURSION_CALL

Variables

node"A"
visited[]
order[]
recursion depth1
Call stackdepth 1
dfs("A")← running

Operation counters

Recursive calls

1

Memory (measurable)

Call-stack frames1
Visited set size0
Auxiliary spaceO(V)

Data structure state

order = []