Depth First Traversal of Graph

In this lesson, we will learn about depth first traversal of a graph using recursion.

What is a Graph?

Graphs represent pairwise relationships between objects. A graph is typically represented as a set of edges and a set of nodes.

A node, also known as a vertex, is a fundamental part of a graph. It is the entity that has a name, known as the key, and other information related to that entity.

A relationship between nodes is expressed using edges.

An edge between two nodes expresses a one-way or two-way relationship between the nodes.

In a computer program, graphs are represented using an Adjacency List or an Adjacency Matrix. We will be using adjacency list representation for this course. If you want to study graphs in detail, review Interview Refresher Course on Data Structures in Javascript.

The diagram below shows an example graph. It has 66 nodes and 66 edges.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy