GraphTheory[SpecialGraphs]
HammingGraph
construct Hamming graph
Calling Sequence
Parameters
Description
Examples
Compatibility
HammingGraph(d,q)
HammingGraph(d,s)
d
-
positive integer
q
s
string of distinct characters
HammingGraph(d,q) returns the Hamming graph, an undirected graph whose vertices correspond to sequences of symbols of length d chosen from some alphabet of size q.
The graph has qd vertices, each of which corresponds to a sequence of the q symbols of length d. Two vertices are connected if the corresponding sequences differ pairwise by a single symbol, that is, if their Hamming distance is 1.
HammingGraph(d,s) returns a Hamming graph equivalent to HammingGraph(d,length(s)) but whose vertices are strings of length q composed from the characters in s.
The graph is named for Richard Hamming.
with⁡GraphTheory:
with⁡SpecialGraphs:
H32≔HammingGraph⁡3,2
H32≔Graph 1: an undirected graph with 8 vertices and 12 edge(s)
DrawGraph⁡H32
H53≔HammingGraph⁡5,3
H53≔Graph 2: an undirected graph with 243 vertices and 1215 edge(s)
NumberOfEdges⁡H53
1215
The GraphTheory[SpecialGraphs][HammingGraph] command was introduced in Maple 2023.
For more information on Maple 2023 changes, see Updates in Maple 2023.
See Also
SpecialGraphs
SpecialGraphs[DeBruijnGraph]
StringTools[HammingDistance]
Download Help Document