Original Authors: David Matula, Leland Beck

Link: https://dl.acm.org/doi/10.1145/2402.322385


The vertices of a graph are in smallest-last order whenever for all , has the smallest degree in the maximal subgraph on the vertices . The paper claims such an ordering always exists and can be found in time.

Smallest Last Vertex Ordering

Denote by the number of vertices in the subgraph adjacent to . Denote by the minimum degree of . For a given ordering , we denote by the subgraph with vertices and their corresponding edges.

With this notation, is in smallest-last order if for all .

Algorithm: Smallest-last Vertex Ordering

Input: Graph with vertices

  1. Set and
  2. Let be a vertex of minimum degree in
  3. Delete from . Set
  4. If , go to step 2. Otherwise, terminate with sequence .

They also provide an algorithm for reordering an adjacency list in conformity with smallest-last ordering.

Algorithm: Reorder adjacency lists

Input: Graph with every adjacency list stored in sequential memory

  1. For each , pack to the rear of the adjacency list for (in any order) all of the list with .
  2. Create pointer pointing to the initial position of the sequential adjacency list for for each . Let
  3. If , stop. Otherwise,
  4. For each entry in the adjacency list of , insert in the position pointed at by in the adjacency list of and let . Then go to step 3.