TOPICS
Search

Graceful Labeling


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.

GracefulLabelingsS4

"Fundamentally distinct" or "fundamentally different" graceful labelings (cf. Gardner 1983, p. 164) refer to labelings that are distinct modulo subtractive complementation and the symmetries of the graph (i.e., the graph automorphism group). Consider the star graph S_4=K_(1,3). There a 12 graceful labelings: ((0, 1, 2, 3), (0, 1, 3, 2), (0, 2, 1, 3), (0, 2, 3, 1), (0, 3, 1, 2), (0, 3, 2, 1), (3, 0, 1, 2), (3, 0, 2, 1), (3, 1, 0, 2), (3, 1, 2, 0), (3, 2, 0, 1), and (3, 2, 1, 0). As is clear from the figure above, these occur when the center is 0 or 3 and the remaining numbers can be arranged in any way among the tips, giving 3!·2 possibilities (3! to account for possible permutations of 3 numbers among the tips and the factor of 2 since that can be done in two ways: with 0 in the center or with 3 in the center). Since all the tips are equivalent by the symmetry of the graph and interchanging 0 and 3 corresponds to subtractive complementation, there is a unique fundamental graceful labeling for S_4. In fact, star graphs S_n are in general uniquely graceful by similar arguments to those above.

For a graph other than K_1 and K_2=P_2, the total number of labelings N_T is related to the number of fundamentally distinct labelings N_F of a graph G by

 N_F=(N_T)/(2|Aut(G)|),

where |Aut(G)| is the order of the graph automorphism group. For example, while there are a large number (5760) of unrestricted graceful labelings of the icosahedral graph, there are only 24 fundamentally different ones (correcting the count of 5 reported by Gardner 1983, pp. 163-164).

The total number of all (not just fundamental) graceful labelings of all simple graphs on n=1, 2, ..., 8 nodes were computed by E. Weisstein on Apr. 3 and Jul. 30, 2020. Knuth (2024, Problem 97) gave the corresponding total counts of fundamentally distinct labelings. These counts, together with total counts of fundamental graceful labelings for all simple graphs, are given in the table below.

OEIStotal of all labelings on n=1, 2, ... verticestotal type
A3337271, 2, 16, 144, 1428, 25328, 631026, 25087224, ...all (not just fundamental) graceful labelings
A3795761, 1, 2, 14, 174, 3655, 122439, 6470268, ...fundamental graceful labelings
A3795750, 1, 2, 13, 157, 3292, 110578, 5903888, ...fundamental graceful labelings of graphs with no isolated points

Graceful labelings may be generated using sparse rulers (cf. Pegg 2019).

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; Knuth 2024, p. 23), 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 m 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 fundamentally distinct graceful labelings for some indexed families of graphs. Arumugam and Bagga (2011) give (total) 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)A000000X, X, 1, 26, 20, ...
Apollonian network1, 33, ...
barbell graphX, X, 1, 0, 0, ...
book graph1, 16, 0, 417, ...
centipede graphA0000001, 1, 4, 30, 232, 2058, 26654, ...
complete bipartite graph K_(n,n)A3356191, 1, 1, 4, 1, 7, 2, 10, 3, 8, 1, 42, 2, 7, 7, ...
complete graph K_n1, 1, 1, 1, 0, 0, 0, 0, 0, 0, ...
complete tripartite graph K_(1,1,n)A0000001, 4, 7, 12, 20, 34, 74, 131, 260, ...
complete tripartite graph K_(n,n,n)1, 1, 0, 0, 0, 0, 0, ...
crown graph K_2 square K_n^_A0000000, 0, 0, 27, 69, X, 0, ...
cycle graph C_nA000000X, X, 1, 1, 0, 0, 6, 12, 0, 0, 104, 246, 0, 0, 3882, ...
dipyramidal graphX, X, 4, 1, 7, 0, 22, X, X, 0, ...
empty graph K^__n1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
gear graphA000000X, X, 34, 358, 6781, 231758, 10575203, 695507601, ...
grid graph P_n square P_nA0000001, 1, 358, 47428572, ...
grid graph P_n square P_n square P_n1, 27, ...
halved cube graph1, 1, 1, 0, ...
Hanoi graph1, 140, ...
helm graphX, X, 109, 777, ...
hypercube graph Q_nA0000001, 1, 27, 607173, ...
n×n king graph1, 1, 154, ...
n×n knight graph1, 0, 12, ...
ladder graph P_2 square P_nA0000001, 1, 16, 177, 2242, 48068, ...
Möbius ladder M_nA000000X, X, 1, 34, 750, 8451, 208882, 5371997, 207664885, ...
pan graphA000000X, X, X, 5, 8, 13, 30, 60, 160, 394, 924, 2434, 7178, 21446, ...
path complement graph P^__nA0000001, 0, 0, 1, 13, 34, 45, 18, 1, ...
path graph P_nA0000001, 1, 1, 1, 2, 6, 8, 10, 30, 74, 162, 332, 800, 2478, 6398, 13980, ...
prism graph P_2 square C_nA000000X, X, 4, 27, 444, ...
star graph S_nA0000001, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
sun graphA000000X, X, 0, 204, 4765, ...
sunlet graphA000000X, X, 9, 42, 255, 2283, 27361, ...
triangular snake graph TS_(2n-1)1, 1, 0, 0, 368, ...
web graphX, X, 894, ...
wheel graph W_nA000000X, X, 1, 4, 12, 23, 67, 251, 1842, 10792, ...

A graph that contains a single fundamentally distinct graceful labeling (i.e., a unique labeling modulo the graph automorphism group and with respect to subtractive complementation) may be termed a uniquely graceful graph, and a graph possessing the maximum possible number of fundamentally distinct labelings (possibly subject to some additional condition such as possessing no isolated vertices) may be termed a maximally graceful graph.


See also

Graceful Graph, Graceful Permutation, Labeled Graph, Maximally Graceful Graph, Ungraceful Graph, Uniquely Graceful Graph

Explore with Wolfram|Alpha

References

Arumugam, S. and Bagga, J. "Graceful Labeling Algorithms and Complexity-A Survey." J. Indonesian Math. Soc., Special edition, 1-9, 2011.Gardner, M. "Mathematical Games: The Graceful Graphs of Solomon Golomb, or How to Number a Graph Parsimoniously." Sci. Amer. 226, No. 3, 108-113, March 1972.Gardner, M. "Golomb's Graceful Graphs." Ch. 15 in Wheels, Life, and Other Mathematical Amusements. New York: W. H. Freeman, pp. 152-165, 1983.Golomb, S. W. "How to Number a Graph." In Graph Theory and Computing (Ed. R. C. Read). New York: Academic Press, pp. 23-37, 1972.Knuth, D. E. §7.2.2.3 in The Art of Computer Programming, Vol. 4B: Combinatorial Algorithms, Part 2. New York: Addison-Wesley, 2022.Knuth, D. E. "Graceful Labeling." §7.2.2.3 in The Art of Computer Programming, Vol. 4. Pre-Fascicle 7A, pp. 16-24, Dec. 5, 2024.Pegg, E. Jr. "Graceful Graphs with Valence k." Aug. 2019. https://math.stackexchange.com/questions/3246000/graceful-graphs-with-valence-k.Sheppard, D. A. "The Factorial Representation of Balanced Labelled Graphs." Discr. Math. 15, 379-388, 1976.Sloane, N. J. A. Sequences A308544, A333727, A379575, and A379576 in "The On-Line Encyclopedia of Integer Sequences."

Cite this as:

Weisstein, Eric W. "Graceful Labeling." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/GracefulLabeling.html

Subject classifications