Graph Search

From NovaOrdis Knowledge Base
Revision as of 22:58, 1 October 2021 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Overview

Searching a graph is a fundamental problem in computer science. It means systematically following the edges of a graph so we visit all the vertices of that graph. Techniques for searching a graph lie at the heart of the field of graph algorithms. There are many methods to search graphs, and the most known and used are breadth-first search and depth-first search.

Both breadth-first search and depth-first search algorithms are very efficient, in that they walk the entire graph in linear time of the number of vertices and edges O(n + m).

Breadth-First Search (BFS)

Depth-First Search (DFS)