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
- Set and
- Let be a vertex of minimum degree in
- Delete from . Set
- 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
- For each , pack to the rear of the adjacency list for (in any order) all of the list with .
- Create pointer pointing to the initial position of the sequential adjacency list for for each . Let
- If , stop. Otherwise,
- 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.