liveBook · Manning

Frontier

As explained in Advanced Algorithms and Data Structures

A frontier is the queue of graph vertices discovered but not yet visited during a breadth-first search.

During breadth-first search, the frontier is the queue of graph vertices discovered but not yet visited. It forms the expanding perimeter of the search. section 14.3.2

Maintain the frontier through these operations:

  • Initialize it with the source vertex. section 14.3.2
  • Dequeue the next vertex, then inspect its adjacency list. section 14.3.2
  • When an undiscovered neighbor is found, assign its distance and enqueue it at the tail. section 14.3.2
  • Use a regular queue because discovery order matches increasing distance from the source; a priority queue is unnecessary. section 14.3.2

BFS frontier update

The pseudocode dequeues v, explores each outgoing edge, and enqueues an undiscovered destination u after setting distance[u] to distance[v] + 1 and recording v as its parent.

How Advanced Algorithms and Data Structures covers it

How deep it goes
Defines the frontier operationally through initialization, dequeueing, neighbor discovery, distance assignment, and enqueueing.
Examples
Illustrates queue progression in a BFS figure and neighbor processing in BFS pseudocode.
What it assumes
Assumes graph vertices, outgoing edges, adjacency lists, and a queue; introduces the frontier through BFS operations.
What you can do after
Apply it via breadth-first search to process vertices by increasing distance from a source.
How it connects
Connects breadth-first search, queues, adjacency lists, graph traversal, distances, parents, and shortest paths.

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.