How this calculation works
Find a minimum-span nonnegative integer radio labeling satisfying every pair’s diameter-dependent distance separation.
|f(u)−f(v)|≥diam(G)+1−d(u,v); min_v f(v)=0; minimize max_v f(v).A worked example
For P₄, diameter=3 and labels [3,0,5,2] have span 5. Adjacent differences are 3,5,3; distance-two differences are 2 and 2; endpoint difference is 1. No smaller span is feasible.
Good to know
Connected simple graphs with at most 8 vertices. All-pairs graph distances, minimum label normalized to zero and exact bounded order/constraint search. Full separation certificate; unresolved cap is not an optimum. Mathematical radio labeling only, not physical frequency or interference engineering.
Reference: Liu and Zhu: multilevel distance labelings (opens in a new tab) ↗
Separate labels according to graph distance
A radio labeling assigns nonnegative integer labels so that nearby vertices receive sufficiently different numbers. The required difference for a pair is the graph diameter plus one minus that pair’s shortest-path distance. Adjacent vertices face the largest separation requirement, while vertices at the diameter still require a difference of at least one.
The objective is the smallest span after shifting the minimum label to zero. The labels are abstract integers. They are not automatically frequencies in hertz or a validated interference plan. A physical radio system needs a model of propagation, bandwidth and receiver constraints that is not supplied by this graph-theoretic distance rule.
Compare this with the Graph bandwidth calculator with optimal vertex ordering. Assign spaced integer channel labels satisfying all-pairs distance separation, rather than permute vertices to minimize adjacent index gaps.
Enter one connected simple graph
The graph supports at most eight vertices, with zero-based undirected edge endpoints. Connectivity ensures every pair has a finite shortest-path distance and the diameter is defined under this convention. Loops, repeated edges and out-of-range endpoints are rejected. A drawing’s Euclidean distances are not used; only edge counts along shortest paths matter.
The calculator determines all pairwise graph distances before optimizing labels. The diameter is the largest such distance. A one-vertex graph has span zero under the natural normalization; larger connected graphs impose positive separation on every distinct pair. Adding one edge can change many shortest paths and the diameter, so it can change more than the new edge’s local constraint.
Normalize translation without losing a solution
Adding one constant to every label leaves all differences unchanged. Any feasible labeling can therefore be shifted until its minimum is zero without changing its span. This removes a redundant degree of freedom. It does not permit scaling labels downward, because the pairwise lower bounds are fixed integers determined by the graph.
Since the lower bound is at least one for every distinct pair, all labels are different. Their increasing order is a permutation of the vertices. For one chosen order, the smallest feasible labels can be built by enforcing every earlier vertex’s required separation. Searching those orders covers candidate labelings while avoiding arbitrary guesses at a large maximum label.
Use every earlier constraint in an order
When placing a vertex after others in increasing label order, its label must be at least the previous label plus the required separation for each earlier vertex. The strongest of those bounds determines the smallest valid placement for that order. Looking only at neighboring vertices in the order can miss a stronger constraint from a vertex placed much earlier.
The bounded search considers orders and compares their resulting spans. A winning order supplies a feasible labeling, while exhaustive failure to obtain a smaller span supplies the lower-bound evidence. Resource limits must not be confused with completion. A best labeling found before an interrupted search is an upper bound, not a certified radio number.
Verify every pair in the default path
The four-vertex path has diameter three. Adjacent vertices must differ by at least three, vertices at distance two by at least two and the two endpoints by at least one. The witness [3,0,5,2] has minimum zero and maximum five. Its adjacent differences are three, five and three, satisfying the strongest local requirements.
The distance-two pairs have differences two and two, and the endpoint pair has difference one. Thus all six pair constraints pass. The completed search excludes smaller spans, making the radio number five for this convention. Displaying those pair checks is more useful than merely drawing four separated labels and asserting that the arrangement looks valid.
Do not confuse radio and distance-two labeling
An L(2,1) labeling uses fixed conditions for distances one and two and generally no conditions beyond that. Radio labeling depends on the entire graph diameter and constrains all distinct pairs. On a large-diameter graph, an adjacent separation can exceed two by a substantial amount. The two optimizations can therefore produce different label spans.
Proper coloring is another different problem: it usually asks only that adjacent labels differ, without controlling numeric distance. Replacing color names with consecutive integers does not automatically create a valid radio labeling. Use the output’s required and actual separation columns to retain the numeric meaning of this particular distance-labeling task.
Read the result as a small-graph certificate
Different minimum label assignments can exist, and reversing labels around the maximum preserves all absolute differences. Vertex relabeling also preserves the optimum when the edges are changed consistently. These symmetries can explain different witness arrays from different implementations without indicating a disagreement about the minimum span.
The graph-size cap keeps complete search practical and explicit. This page does not extrapolate a formula for larger graphs from a few examples or return a heuristic span as if it were exact. Retain the distance matrix, labeling and checked constraint table with the result when using it in a mathematical argument or comparing a published example.
A few questions, answered
Why is the minimum label zero?
Translating all labels leaves every difference unchanged, so normalization loses no feasible span.
Can two vertices share a label?
No. Even a pair at the diameter requires a difference of at least one.
Is this an L(2,1) labeling?
No. Radio separation depends on the diameter and constrains every pair.
Are these physical frequencies?
No. They are graph-theoretic integer labels under a mathematical distance rule.