---
title: BFS Link Iteration Rule Overview
url: https://www.emergentmind.com/topics/breadth-first-search-bfs-link-iteration-rule
type: topic
---

# BFS Link Iteration Rule Overview

Breadth-first search (BFS) link iteration rule denotes the operational condition that determines how a traversal expands a current frontier, scans adjacency links, and decides when a vertex is first reached and inserted into the next layer. Across the literature, the rule appears in several formally distinct forms: as a level-synchronous frontier recurrence in ordinary graph search, as a canonical parent-selection constraint in BFS-enumerated graphs, as temporal forward-neighbor expansion in evolving graphs, as a nonzero-state transition in matrix-driven traversals, and as an implementation rule governing gray-vertex, bitmap, queue, or distributed-frontier iteration [2507.12925] [1804.02273] [1601.08189] [2407.10790]. For the FOON-specific paper "A comparative study of the performance of different search algorithms on FOON graphs" [2210.07428], no PDF or source is available in the supplied material, so no FOON-specific BFS procedure, link iteration rule, stopping condition, or comparative technical detail can be extracted faithfully.

## 1. Static frontier expansion

In the ordinary formulation restated in the semi-external BFS study, BFS starts from a source node \(s\), marks \(s\) visited, and enqueues all out-neighbors \(N^+(s,G)\). It then repeatedly dequeues the first node \(u\), and, if \(u\) is unmarked, marks \(u\) and enqueues all its out-neighbors. The underlying layer-expansion rule is written as
\[
\text{frontier}_{\ell+1} = \{\, v \mid \exists u\in \text{frontier}_\ell,\ (u,v)\in E,\ v \notin \text{visited} \,\},
\]
with
\[
N^+(u,G)=\{v \mid (u,v)\in E(G)\}.
\]
The same source states the standard running time as \(O(n+m)\), using a queue \(Q\) of size \(O(n+m)\) [2507.12925].

The multicore study "Performance-Driven Optimization of Parallel Breadth-First Search" [2503.00430] presents the same rule in CSR form. For each frontier vertex `src`, the traversal scans all adjacency entries in the range
\[
\text{for } j = rptr[src] \text{ to } rptr[src+1]-1,
\qquad dst = col[j],
\]
and visits `dst` if it has not been reached with a shorter distance. The Xeon Phi top-down study gives the corresponding predecessor-form update:
\[
\text{if } vis.Test(v)=0 \text{ then } vis.Set(v),\ out.add(v),\ P[v]=u.
\]
These formulations agree on the core link iteration rule: traverse all outgoing adjacency entries of the current frontier and admit a neighbor into the next frontier only if it is not already discovered [1604.02844] [2503.00430].

## 2. Canonical parent selection and BFS-enumerated graphs

In symmetry breaking for SAT/CSP graph search, the BFS link iteration rule is not expressed as a queue operation but as a predicate on vertex numbering and parent assignment. A connected undirected graph \(G\) is BFS-enumerated when there exists a BFS traversal such that, for all \(k\) from \(1\) to \(|V(G)|\), the \(k\)-th vertex in this traversal has label \(k\). The encoding introduces parent variables \(p_i\) for \(i\in 2..|V|\), where \(p_i\) denotes the label of the parent of node \(i\), and constrains them by
\[
\forall i: p_i \le p_{i+1},
\]
together with the canonical parent rule
\[
\forall i, j: p_j = i \Leftrightarrow A[i, j] \wedge \nexists k < i: A[k, j].
\]
This is the paper’s central BFS link iteration condition: vertex \(j\) links to the smallest-numbered earlier vertex adjacent to it [1804.02273].

The same study emphasizes that BFS traversal induces layers but does not constrain the order of vertices within a layer. That observation motivates the strengthened predicates \(P_{BFS}^+\) and \(P_{BFS}^*\). The former fixes the start vertex by requiring
\[
P_{BFS}^+(G)=1 \iff P_{BFS}(G)=1 \text{ and } \deg v_1 = \max_{1 \le k \le n}\deg v_k,
\]
while the latter orders siblings by subtree weight:
\[
\forall v \in V(G):\quad
w(\mathrm{child}(v)_1) \ge w(\mathrm{child}(v)_2) \ge \ldots \ge w(\mathrm{child}(v)_k).
\]
The paper proves that \(P_{BFS}\), \(P_{BFS}^+\), and \(P_{BFS}^*\) are all symmetry-breaking predicates among connected graphs. A common misconception is therefore that a BFS order is intrinsically unique; the paper shows that plain BFS enumeration still leaves symmetries, and that additional root-selection and subtree-ordering constraints are needed to obtain a more canonical numbering [1804.02273].

## 3. Temporal forward neighbors and causal links

For evolving graphs, the BFS link iteration rule is generalized from spatial adjacency to adjacency in space and time. An evolving graph is a time-ordered sequence
\[
G_n=\langle G^{[1]},G^{[2]},\ldots,G^{[n]}\rangle,
\qquad
G^{[t]}=(V^{[t]},E^{[t]}),
\]
and a temporal node is a pair
\[
(v,t), \qquad v\in V^{[t]}.
\]
The paper allows causal edges
\[
\langle (v,t),(v,t')\rangle,\qquad t<t',
\]
which represent waiting or propagation of identity through time. The BFS update is therefore not restricted to same-time neighbors: when a frontier node \((v,t)\) is expanded, the algorithm must follow both spatial links at time \(t\) and causal links to the same node at later active times. The recurrence is given as
\[
\text{nextfrontier} \leftarrow \bigcup_{(v,t)\in \text{frontier}} \mathrm{forwardneighbors}(v,t),
\]
with already-reached temporal nodes removed [1601.08189].

The same paper shows that naive unfolding of adjacency matrices miscounts temporal paths. In its example, the naive product yields
\[
(S^{[t_3]})_{13}
=
\left(A^{[t_1]}A^{[t_2]}A^{[t_3]} + A^{[t_1]}A^{[t_3]}\right)_{13}
=1,
\]
even though there are actually two valid temporal paths from \((1,t_1)\) to \((3,t_3)\). The discrepancy is caused by ignoring causal edges. Adding ones on the diagonal does not repair the issue, because it introduces illegal paths that stay on inactive nodes. The paper resolves this by mapping the evolving graph to an equivalent static directed graph whose vertices are the active temporal nodes and whose edges include both within-time edges and causal edges \(E'\). Under that mapping, BFS on the evolving graph is equivalent to ordinary BFS on the corresponding static graph [1601.08189].

## 4. Algebraic iteration rules and matrix-driven traversals

A different line of work derives BFS-like traversal rules from iterative methods for solving a linear system built from a graph’s adjacency matrix. In that framework, the graph matrix is modified by replacing zero diagonal entries with a positive value \(d>0\), the right-hand side is chosen as \(b=e_s\), and the initial state is \(x^{(0)}=d\cdot e_s\). A vertex enters the frontier when its state-vector component changes from zero to nonzero:
\[
(x_i^{(k)}=0)\ \mbox{and}\ (x_i^{(k+1)}\neq 0).
\]
This transition rule defines the frontier \(\mathcal{F}^{(k+1)}\). The paper also states the basic BFS-algebraic recurrence
\[
x^{(k+1)} = A x^{(k)}, \qquad x^{(0)} = e_s,
\]
and interprets the nonzero components of \(x^{(k)}\) as the vertices reached after iteration \(k\) [2407.10790].

Within this framework, the Jacobi-based traversal rule is
\[
x_i^{(k+1)}=\biggl(-b_i+\sum\limits_{j\neq i}a_{ij}x_j^{(k)}\biggr)(-d),
\]
and Theorem 1 states that, with \(b=e_s\) and \(x^{(0)}=d\cdot e_s\), Jacobi iterations produce the same traversal as combinatorial BFS. By contrast, the Gauss-Seidel rule
\[
x_i^{(k+1)}=\biggl(-b_i+\sum\limits_{l=1}^{i-1}a_{ij}x_j^{(k+1)}+\sum\limits_{j=i+1}^{n}a_{ij}x_j^{(k)}\biggr)(-d)
\]
produces Correct Chain Search (CCS), which is generally neither BFS nor DFS. The paper defines a correct chain as
\[
c=\{i_0,i_1,\ldots,i_k\}, \quad (i_{j-1},i_j)\in E,\quad i_{j-1}<i_j.
\]
Because values computed earlier in the same sweep can influence later components immediately, CCS may continue along correct chains in a single iteration. The paper formalizes that, for the same starting vertex on a connected graph, CCS completes its work in a number of iterations equal to or less than required for BFS, and for many instances fewer iterations are required. A plausible implication is that the BFS link iteration rule can be viewed not only as a combinatorial queue discipline but also as a particular numerical update policy, with Gauss-Seidel exposing the effect of vertex numbering on propagation [2407.10790].

## 5. Frontier representations, coloring schemes, and dominance pruning

Several studies preserve BFS layer semantics while replacing the conventional queue by a specialized frontier representation. In the space-efficient 3-color BFS, vertices are colored white, gray, or black. The abstract algorithm performs an exploration round over all gray vertices and colors gray all white neighbors of an eligible vertex \(u\), where, in undirected graphs, eligibility means \(u=s\) or \(u\) has a black neighbor. A consolidation round then colors \(u\) black if it has no white neighbor. The technical novelty is dynamic iteration over the changing set of gray vertices, not a new graph-theoretic visitation order. The paper proves that BFS can be carried out in \(O(n+m)\) time with
\[
n\log_2 3+O((\log n)^2)
\]
bits of working memory [1812.10950].

The in-place BFS on the word RAM replaces the queue by a 4-color choice dictionary with colors white, light-gray, dark-gray, and black. Light-gray vertices form the current frontier, dark-gray vertices are the next frontier, and after processing a vertex it becomes black. For a frontier vertex \(v\), the adjacency scan is specified by
\[
p = \mathcal{T}[v], \qquad q = \mathcal{T}[v+1] - 1,
\]
and for each
\[
u = A[j], \quad p \le j \le q,
\]
the algorithm checks whether \(D.color(u)=\textsc{white}\); if so, it colors \(u\) with the next frontier color. The frontier colors alternate by round parity, so if \(z\) is even the algorithm processes light-gray and colors newly found vertices dark-gray, and if \(z\) is odd the roles reverse [1803.04282].

A more abstract reformulation appears in Efficient Breadth-First Search (EBFS). There the frontier is not a set of vertices but a set of subspaces, and link iteration is embedded in a recursive rule that expands all subspaces of the current frontier and keeps only the undominated ones:
\[
GO_{x}(y)=opt_{c}\{z\mid\chi(y,z)\wedge o(x,z)\}\cup\bigcup_{yy\in undom(y)}GO_{x}(yy).
\]
The pseudo-Haskell schema
```haskell
bfs x frontier =
  let localsof y = ...
      locals  = (flatten.map) localsof frontier
      allsubs = (flatten.map) (subspaces x) frontier
      undom = {yy : yy ∈ allsubs
               (yy' ∈ subs yy ⇒ yy' `dominates` yy ⇒ yy == yy')}
      subsolns = bfs x undom
  in opt(locals ∪ subsolns)
```
shows that breadth-wise expansion can be preserved while pruning dominated children before recursion. This suggests that the essential content of a BFS link iteration rule is layerwise expansion plus an admissibility condition; the concrete frontier representation may vary substantially [1207.0869].

## 6. Parallel, hybrid, and distributed edge iteration

In ordered parallel BFS by arc elimination, the current frontier is an explicit queue \(Q\), and the next frontier is \(Q'\). For each dequeued vertex \(u\), the algorithm scans still-uneliminated outgoing arcs in fixed adjacency order, using the condition
\[
ADJ[u].first<ADJ[u].outdeg
\]
to test whether a non-eliminated outgoing arc remains. When a new target \(v\) is discovered, all incoming arcs of \(v\) are eliminated in parallel, and the algorithm updates
\[
ADJ[v].traversal \gets a,\qquad
ADJ[v].distance \gets l,\qquad
ADJ[v].parent \gets u,
\]
before enqueuing \(v\) into \(Q'\). The elimination invariant ensures that once a vertex is visited it cannot be rediscovered [1305.1222].

Hybrid BFS modifies the link iteration domain rather than the basic distance-layer semantics. In top-down mode, the current frontier is expanded by scanning all outgoing neighbors of each frontier vertex. In bottom-up mode, the algorithm iterates over all unvisited vertices, scans each adjacency list, and stops at the first neighbor found in the current frontier:
```c
for (vidType v = 0; v < N; v++) {
  if (dist[v] == MAX_DISTANCE) {
    for (uint32_t j = rptr[v]; j < rptr[v+1]; ++j) {
      vidType neighbor = col[j];
      if (curr_front_bm[neighbor]) {
        dist[v] = depth + 1;
        nxt_fsz++;
        nxt_front_bm[v] = true;
        break;
      }
    }
  }
}
```
One paper uses the simplified switching rule
\[
is\_top\_down = (cfsz < 0.05 \cdot N) ? true : false,
\]
while another presents architecture-specific threshold functions \(f(n,e_f,v_f,e_u)\) and \(g(n,e_f,v_f,e_u)\). The same 2025 study also introduces a non-atomic distance update mechanism in which multiple threads may write the same level value concurrently; it explicitly notes that this is technically a C++ data race / undefined behavior, although the concurrent writes are intended to be value-consistent in the level-synchronous setting [2503.00430] [1704.02259].

Vectorized implementations retain the same acceptance rule but batch adjacency tests. In top-down Xeon Phi BFS, the bitmap-based discovery condition is
\[
\neg(vis.TestBit(v)\ \lor\ out.TestBit(v)),
\]
implemented with gather and scatter over 16 lanes. In vectorized bottom-up BFS, the algorithm loads 16 consecutive vertices, filters visited vertices with a bitmap mask, iterates over adjacency positions in lockstep up to `MAX_POS`, and falls back to scalar bottom-up processing when necessary. At the distributed scale, ButterFly BFS keeps two queues per compute-node, `Q_global[g]` and `Q_local[g]`, and applies a level-synchronous traversal rule:
```text
for each frontier vertex v in Q_local[g]:
    for each u in adj(v):
        if d_local[g][u] == infinity:
            success = Q_global[g].Enqueue(u)
            if success:
                d_local[g][u] = level + 1
                if u in myVertices[g]:
                    Q_local[g].Enqueue(u)
```
followed by butterfly synchronization over rounds determined by `ButterflyDirection(g,i)`. The paper characterizes the communication depth as
\[
\log_f(CN),
\]
with \(f \cdot \log_f(CN)\) messages per compute-node and buffer requirement \(O(f\cdot V)\) [1604.02844] [1704.02259] [2103.13577].

## 7. External, semi-external, and unavailable FOON-specific formulations

External-memory and semi-external studies shift the emphasis from per-edge acceptance to staged maintenance of BFS layers. In dynamic external-memory BFS under monotone updates, the central rule is that the adjacency list for a vertex \(v\) is added to the sorted pool \(\mathcal H\) when creating BFS level
\[
\max\{0, d_{i-1}(v)-\alpha\}
\]
of the updated graph. Each new BFS level of \(G_i\) is then constructed by merging a subsequence of \(\mathcal S\), accounting for one BFS level in \(G_{i-1}\), with \(\mathcal H\) using simple scanning. For decremental updates, the paper states the symmetric rule of applying a lag of \(\alpha_j\) levels instead of an advance. Its main theorem gives amortized
\[
O\bigl(n/B^{2/3}+sort(n)\cdot \log B\bigr)
\]
I/Os per update with high probability for sparse undirected graphs under monotone update sequences [0802.2847].

Semi-external BFS rephrases link iteration as repeated restructuring of a spanning tree. In EE-BFS, the algorithm scans every edge \(e=(u,v)\) and, if \(e\) is a V-BFS edge, makes \(v\) the rightmost child of \(u\). EB-BFS introduces a stipulation that, after traversing \(u\), BFS first adds the nodes in \(N^+(u,T)\) to its queue from the leftmost child of \(u\) on \(T\) to the rightmost child, and then adds \(v\) into \(T\) if \((u,v)\in\mathbb E\), from front to back. EP-BFS retains only two attributes per node, \(u.\mathcal B\) and \(u.\mathcal P\), keeps an in-memory tree fragment \(\mathbb T\), and filters edges using a threshold \(\mathcal F[i]\): an edge \((u,v)\) is added to the in-memory edge set \(\mathbb E\) if both endpoints satisfy \(u.\mathcal B\ge \mathcal F[i]\) and \(v.\mathcal B\ge \mathcal F[i]\), or if \((u,v)\) is a V-BFS edge under the current tree. During `EP-Reduce`, the queue is simulated by indices
\[
\mathcal{I}_f \gets \mathcal{F}_R+1,\qquad \mathcal{I}_b \gets \mathcal{F}_C+1,
\]
and the algorithm pops \(s=\text{BON}[\mathcal I_f]\), sets \(s.\mathcal B=\mathcal I_f\), and enqueues each unmarked out-neighbor while setting its parent [2507.12925].

The FOON-oriented paper [2210.07428] cannot presently support any technical encyclopedia treatment of a FOON-specific BFS link iteration rule. The supplied material states only that there is no PDF and no source to generate one, and explicitly provides no FOON graph traversal discussion, no BFS/GBFS/IDFS description, no stopping conditions, no pseudocode, and no experimental results. The only defensible conclusion is that any FOON-specific BFS link iteration rule attributed to that paper would be unsupported by the available text [2210.07428].

Source: https://www.emergentmind.com/topics/breadth-first-search-bfs-link-iteration-rule