Advanced maths

Graph distinguishing number calculator with a symmetry breaking labeling

Find the fewest vertex labels that destroy every nonidentity automorphism of a small simple graph and return a distinguishing labeling.

Your numbers

One edge per row, zero-based endpoint indices. Enter none for an edgeless graph where the method permits one.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Find the fewest vertex labels that destroy every nonidentity automorphism of a small simple graph and return a distinguishing labeling.

THE FORMULAD(G)=min |f(V)| such that [f(σ(v))=f(v) for every v and σ∈Aut(G)] implies σ=id.

A worked example

The four-vertex path has one nonidentity symmetry, reversal. Labels [1,1,1,2] break that symmetry, while one common label does not. Its distinguishing number is therefore 2.

Good to know

Simple undirected graph with 1–8 vertices, zero-based edge endpoints, no loops or repeated edges. Complete bounded automorphism and canonical label-partition search. Labels need not form a proper coloring; search-cap failure is unresolved, not an estimated distinguishing number.

Destroy symmetry with as few labels as possible

A graph automorphism permutes vertices while preserving adjacency. A distinguishing labeling assigns labels so that the only automorphism preserving every vertex label is the identity. The distinguishing number is the smallest number of labels for which such an assignment exists. It measures how much marking is needed to eliminate symmetry in the graph’s structure.

This is different from proper vertex coloring. Adjacent vertices may share a distinguishing label, and nonadjacent vertices may need different labels to prevent an automorphism. The calculator optimizes label count under symmetry constraints, not under an adjacency exclusion rule. A familiar coloring intuition can therefore give an unnecessarily large or insufficient label set.

A two-label endpoint marking destroys the four-vertex path’s only nonidentity automorphism1112P₄: mark one endpoint differentlyReversal swaps unlike endpoint labels; D(P₄)=2
Scroll across to see the full diagram.
A two-label endpoint marking destroys the four-vertex path’s only nonidentity automorphism.

Compare this with the Graph automorphism group calculator with vertex orbits. Find the fewest vertex labels that destroy every nonidentity automorphism; automorphism enumeration alone does not optimize such a labeling, and proper coloring has different constraints.

Enter the graph independently of its drawing

Provide one to eight vertices and undirected edges using zero-based endpoint indices. Every endpoint must refer to an entered vertex, and loops or repeated edges are rejected. Isolated vertices are allowed because their permutations are part of the symmetry problem. The graph’s appearance on a page does not add geometric restrictions to its automorphisms.

For example, drawing one vertex slightly above another does not distinguish them in this calculation. Only adjacency and the final labels matter. Edge weights, directions and preexisting colors are not part of the supported input. If such features should constrain automorphisms, they require an explicitly different graph model rather than an interpretation of the diagram.

Enumerate structural symmetries completely

The bounded method tests vertex permutations against the adjacency relation. Degree classes and other structural checks can prune impossible mappings, but the returned automorphism collection must remain complete within the supported graph. Missing a symmetry would make a labeling appear distinguishing even when a nonidentity label-preserving automorphism actually exists.

The identity automorphism always remains. An asymmetric graph has no other automorphisms, so one common label is sufficient. At the opposite extreme, all vertices of a complete graph can be permuted arbitrarily. Every vertex must then receive a different label to eliminate all swaps. These examples check both the low and high ends of the supported problem.

Search label partitions rather than label names

Renaming label red to label blue everywhere does not alter whether a labeling destroys symmetry. The search can therefore use canonical partitions of the vertex set rather than trying every arbitrary label name assignment. Start with one label and increase the allowed count until a complete search finds a distinguishing witness.

For each candidate assignment, test whether any nonidentity automorphism preserves it. A valid witness has a label-preserving stabilizer containing only the identity. To establish minimality, smaller label counts must have been ruled out completely. Finding one witness alone proves an upper bound; it does not establish the minimum without that preceding search.

Verify the four-vertex path example

The default path has edges zero–one, one–two and two–three. Its two automorphisms are the identity and reversal. Assigning one common label to every vertex leaves reversal intact, so one label fails. Labeling the last endpoint differently, for example [1,1,1,2], makes reversal exchange different labels.

No other nonidentity automorphism exists on this path, so the displayed assignment distinguishes it with two labels. The matching one-label lower bound makes the minimum exactly two. Notice that the first two adjacent vertices share a label. That is valid here and directly demonstrates why the answer is not governed by proper-coloring constraints.

Read the witness using vertex indices

The returned label list follows the input’s zero-based vertex order. Compare each automorphism against those indices when checking the witness. A different minimum labeling may use another endpoint or rename the labels; such changes can be equivalent and do not imply a different distinguishing number. The objective is the count of labels used.

Relabeling the graph’s vertex identifiers also leaves its distinguishing number unchanged, provided the edges are relabeled consistently. It can change which witness the bounded search encounters first. Do not compare two witness arrays position by position after changing vertex names without applying that same identifier correspondence to the labels and automorphisms.

Distinguish exact completion from a search limit

Permutation and partition searches grow rapidly, which is why this page supports only small graphs. If a work cap is reached before all smaller label counts are excluded, the calculator reports an unresolved search. It must not describe the best witness found so far as a certified minimum merely because that witness passes its stabilizer check.

Use the automorphism count, the minimum label count and the returned assignment together. This page answers a structural marking question; it does not encode physical distinguishability, graph drawing positions or network security guarantees. For an adjacency coloring, use a coloring calculator rather than treating a symmetry-breaking label assignment as a collision-free channel allocation.

A few questions, answered

May adjacent vertices have the same label?

Yes. A distinguishing labeling breaks automorphisms; it need not be a proper coloring.

Why is one label sufficient for an asymmetric graph?

Its only automorphism is already the identity, so no extra marking is needed.

Can different minimum labelings be correct?

Yes. Labels can be renamed and several assignments can break the same symmetries.

Does a valid witness prove the minimum?

It proves an upper bound; complete failure for every smaller count is also needed for minimality.

Find your calculator

Start typing to explore the library.