Lexicographic breadth-first search (LexBFS) is a graph search that selects the unselected graph vertex with
the largest label in lexicographic order.
For a finite simple graph
with vertices, each label starts as an empty sequence.
At selection
, ...,
,
append
to the label of every unselected neighbor of the chosen
graph vertex. A proper extension of a label ranks
above that label, and ties among equal labels can be broken arbitrarily (Rose et
al. 1976). Thus, among two candidates with different labels, the first selected
graph vertex adjacent to just one candidate gives
that candidate priority. Maximum cardinality
search instead compares just the numbers of selected neighbors.
The reverse of a LexBFS selection order is a perfect elimination ordering iff the graph is chordal (Rose et al. 1976). For a general input graph, the search order must be tested to decide chordality.
A linear time implementation represents equal labels as blocks in a list ordered from largest to smallest label. After selecting a graph vertex from the first block, split each block containing its unselected neighbors into those neighbors followed by the other members, retaining the old order of the blocks. Processing only affected blocks via adjacency lists gives time linear in the total numbers of vertices and edges. The subsequent ordering test also takes linear time (Rose et al. 1976).
Corneil et al. (1999) used lexicographic breadth-first search to find a dominating pair in an asteroidal triple-free graph that is a connected graph with at least two vertices. Their algorithm takes linear time.