The Wayback Machine - https://web.archive.org/web/20201020044004/https://mathworld.wolfram.com/GracefulLabeling.html

Graceful Labeling

DOWNLOAD Mathematica Notebook GracefulGraphs

A graceful labeling (or graceful numbering) is a special graph labeling of a graph on m edges in which the nodes are labeled with a subset of distinct nonnegative integers from 0 to m and the graph edges are labeled with the absolute differences between node values. If the resulting graph edge numbers run from 1 to m inclusive, the labeling is a graceful labeling and the graph is said to be a graceful graph.

Not all graphs possess a graceful labeling; those that do not are said to be ungraceful.

Some gracefully numbered graphs are illustrated above.

The vertex labels must include 0 and m. This can be seen since the edge labels must contain m, but the only way to form an absolute difference of m from two vertex labels each between 0 and m inclusive is for one to be 0 and the other to be m. Furthermore, the vertices bearing labels 0 and m must be adjacent for the same reason.

If a set of labels (l_1,l_2,...,l_k) form a graceful labeling for a graph, then so do the labels (m-l_1,m-l_2,...,m-l_k). Therefore, with the exception of the singleton graph K_1, all graceful graphs have an even number of graceful labelings.

"Fundamentally different" graceful labelings refer to labelings that are distinct modulo subtractive complementation and the symmetries of the graph (i.e., the graph automorphism group). For example, while there are a large number of graceful labelings of the icosahedral graph, there are only a small number of fundamentally different ones (cf. Gardner 1983, pp. 163-164, who reported a computation producing 5 fundmanetally different labelings; the actual number seems to be 24).

The total number of graceful labelings of all simple graphs on n=1, 2, ... nodes are 1, 2, 16, 144, 1428, 25328, 631026, 25087224, ... (OEIS A333727; E. Weisstein, Apr. 3 and Jul. 30, 2020).

GracefulGraph2Mod4

Interestingly, most small graphs seem to have a number of labelings N satisfying N=4 (mod 0). Of all ungraceful simple graphs on 8 of fewer vertices, 1872 have N=4 (mod 2), while 11291 have N=4 (mod 0). Of the graphs with N=4 (mod 2) having between 2 and 7 nodes (to exclude the special case P_2), all are apex graphs, asymmetric, class 1, cyclic, identity, noneulerian, and weakly perfect. The smallest value N for graphs on 8 or fewer vertices (other than P_2) having N=4 (mod 2) is N=130, which occurs for the single graph on 6 nodes illustrated above.

UnrestrictedGracefulGraph

There also exist graphs whose vertices can be labeled with distinct nonnegative integers such that graph edge numbers run from 1 to m, but where the maximum vertex number must exceed m. Since such graphs violate the maximum allowed vertex label in the definition of gracefulness, they are ungraceful. An example of such a graph is the disjoint union P_3 union K_(1,3) of the path graph P_3 and claw graph K_(1,3), illustrated above. While there appears to be no standard term for such graphs in the literature, they might be termed "excessively graceful."

Graceful labelings may be generated using perfect rulers, i.e., rulers of integer length n with the minimum possible numbers of marks so that all distances 1 to n can be measured.

There are m! graceful labelings for graphs on m graph edges having no isolated points corresponding to the Lehmer encodings of the m! permutations of (0,1,...,m-1) (Sheppard 1976), although some of these correspond to alternate labelings of the same graph. The numbers of nonisomorphic graceful graphs with no isolated points on m edges for m=1, 2, ... are 1, 1, 3, 5, 12, 37, 112, 340, 1078, 3620, 12737, ... (OEIS A308544), while the numbers of connected graceful graphs on e edges are 1, 1, 3, 5, 11, 28, 79, 227, 701, 2302, 8071, ... (OEIS A308545).

Golomb showed that the number of graph edges connecting the even-numbered and odd-numbered sets of nodes is |_(m+1)/2_|, where m is the number of graph edges.

The following table summarizes the numbers of graceful labelings (including those that are symmetry-equivalent or subtractive complements). Arumugam and Bagga (2011) give counts for the cycle graph C_n up to n=24, though typographical errors are present for n=16 and 23.

classOEIScounts
antiprism graph Ci_(2n)(1,2)A326576X, X, 96, 832, 8080, ...
Apollonian network48, 396, ...
barbell graphX, X, 16, 0, 0, ...
book graph16, 128, 0, 40032, ...
centipede graphA3343512, 4, 16, 120, 928, 8232, 106616, ...
complete bipartite graph K_(n,n)A3377932, 16, 144, 9216, 57600, 14515200, ...
complete graph K_n1, 2, 12, 48, 0, 0, 0, 0, 0, 0, ...
complete tripartite graph K_(1,1,n)A33430712, 32, 168, 1152, 9600, 97920, 1491840, 21127680, ...
complete tripartite graph K_(n,n,n)12, 96, 0, 0, 0, 0, 0, ...
crown graph K_2 square K_n^_A326747X, X, 0, 2592, 33120, ...
cycle graph C_nA333720X, X, 12, 16, 0, 0, 168, 384, 0, 0, 0, 4576, 11808, ...
dipyramidal graphX, X, 96, 96, 280, 0, 1232, ...
empty graph K^__n1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
gear graphA337795X, X, 408, 5728, 135620, 5562192, 296105684, ...
grid graph P_n square P_nA3377961, 16, 5728, 758857152, ...
grid graph P_n square P_n square P_n1, 2592, ...
Hanoi graph12, 1680, ...
helm graphX, X, 1308, 12432, ...
hypercube graph Q_nA3380052, 16, 2592, 466308864, ...
n×n king graph1, 0, 384, ...
n×n knight graph1, 48, 2464, ...
ladder graph P_2 square P_nA3337192, 16, 128, 1416, 17936, ...
Möbius ladder M_nA337794X, X, 144, 1088, 30000, 405648, 11697392, ...
pan graphA333729X, X, X, 20, 32, 52, 120, 240, 640, 1576, 9736, ...
path complement graph P^__nA3364281, 0, 0, 4, 52, 136, 180, 72, 4, ...
path graph P_nA0069671, 2, 4, 4, 8, 24, 32, 40, 120, 296, 648, ...
prism graph P_2 square C_nA336677X, X, 96, 2592, 17760, ...
star graph S_nA0985581, 2, 4, 12, 48, 240, 1440, 10080, 80640, ...
sun graphA337792X, X, 0, 3264, 95300, ...
sunlet graphA333757X, X, 108, 672, 5100, 54792, ...
triangular snake graph TS_(2n-1)1, 12, 0, 0, 5888, ...
web graphX, X, 10728, ...
wheel graph W_nA333672X, X, X, 48, 64, 240, 552, 1876, 8032, 66312, ...

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.