Search⌘ K
AI Features

Graph Reductions: Flood Fill

Explore how the flood fill algorithm applies graph theory concepts by reducing the problem to reachability in a pixel map graph. Understand the use of whatever-first search to efficiently color connected pixel regions, and learn practical optimizations for implementation without explicit graph structures. This lesson helps you grasp graph reductions and their application in solving raster graphics problems using Java.

Flood fill problem using whatever-first search

One of the earliest modern examples of whatever-first search was proposed by Edward Moore in the mid-1950s. A pixel map is a two-dimensional array whose values represent colors; the individual entries in the array are called pixels, an abbreviation of picture elements. A connected region in a pixel map is a connected subset of pixels that all have the same color, ...