Isometric Hamming embeddings of weighted graphs

A mapping α:V(G)→V(H) from the vertex set of one graph G to another graph H is an isometric embedding if the shortest path distance between any two vertices in G equals the distance between their images in H. Here, we consider isometric embeddings of a weighted graph G into unweighted Hamming graphs, called Hamming embeddings, when G satisfies the property that every edge is a shortest path between its endpoints. Using a Cartesian product decomposition of G called its canonical isometric representation, we show that every Hamming embedding of G may be partitioned into a canonical partition, whose parts provide Hamming embeddings for each factor of the canonical isometric representation of G. This implies that G permits a Hamming embedding if and only if each factor of its canonical isometric representation is Hamming embeddable. This result extends prior work on unweighted graphs that showed that an unweighted graph permits a Hamming embedding if and only if each factor is a complete graph. When a graph G has nontrivial isometric representation, determining whether G has a Hamming embedding can be simplified to checking embeddability of two or more smaller graphs.


Introduction
Isometric embeddings, or distance-preserving mappings from the vertices of one graph to another, are well studied for unweighted graphs but remain relatively unstudied for weighted graphs. Such embeddings have important applications in molecular engineering to design sets of DNA strands with pre-specified binding strengths that generate nontrivial emergent behaviors [9,26,32,1,21], with utility in DNA memory [3,22,4] and DNA reaction cascades [23,31,24,5]. More generally, isometric embeddings are useful whenever a graph's distance metric is of primary interest, and representation in another graph can simplify analysis or manipulation of graph distances. Of particular interest are embeddings into Hamming graphs, or products of complete graphs. For example, this task appears in communication theory because Hamming graphs permit maximally efficient information routing without inspecting the global network structure [12]; in linguistics to relate the closeness of linguistic objects to simpler predicate vector models [11]; and in coding theory to optimize error-checking codes based on Hamming distance [18]. Figure 1: Embedding weighted graphs is more difficult than unweighted graphs, and some guarantees for unweighted graphs no longer hold. a) A simple graph which is embeddable in a hypercube, but which is not covered by previous theorems on hypercube embeddings of weighted graphs. This is hypercube embeddable because it is isometrically embeddable into (K 2 ) 4 × (K 3 ) 2 . b) A weighted graph that permits a hypercube embedding, but for which the unweighted graph generated via edge subdivision is not. c) A weighted graph, K 4 with uniform edge weights of 2, for which multiple non-equivalent hypercube embeddings exist.
Finding isometric embeddings into a particular destination graph or determining their existence is nontrivial, even with simple graphs like Hamming graphs. A large body of work addresses isometric embeddings of unweighted graphs [8,30,29,13,10] but studies of weighted graphs have considered only embeddings of limited classes of graphs into hypercubes [27,7,20]. Our interest in the isometric graph embedding problem initially stemmed from molecular engineering, in which the metrics we wish to embed are generally complex and rarely fall into a previously studied graph type (Figure 1a). Naïve attempts to convert weighted graphs into unweighted graphs via edge subdivision can produce unweighted graphs without an isometric embedding when the original weighted graph did permit such an embedding (Figure 1b). In addition, weighted graphs may have multiple non-equivalent isometric embeddings into a single destination graph (Figure 1c), which does not occur with unweighted graphs [13]. Indeed, the concept of pseudofactorization, which is central to the study of isometric embeddings for unweighted graphs, has only recently been extended to weighted graphs [25].
The results of this paper apply specifically to those weighted graphs for which each edge is a shortest path between its endpoints, which we call minimal graphs. Such graphs are natural to study in the context of isometric embeddings because an edge with weight greater than the distance between its endpoints will not affect the graph's shortest path metric. When only the distances in a graph are of interest, our results also apply to any graph with positive edge weights, because the graph can be made minimal without affecting distances through edge removal. Similarly, our results can apply to any finite metric space by representing it in a minimal graph. Notably, multiple graphical representations generally exist for a given finite metric space, and each may have different embedding properties [16].

Prior work 1.Pseudofactorization of graphs
The Cartesian graph product of k ≥ 1 graphs is a graph whose vertex set is the Cartesian product of the vertex sets of each factor graph, and whose edge set is such that each edge of the product graph corresponds to a single edge from a single one of the factors (Figure 2a).
Cartesian graph products have the important property that every path in the product graph can be decom-posed into paths in the factor graphs. This property makes Cartesian products relevant to isometric embeddings, because the the product graph's shortest path distance metric is represented in the distance metrics of the factor graphs. Following the convention of Sheridan et al. [25], a pseudofactorization of G is any collection of graphs such that G is isomorphic to an isometric subgraph of their Cartesian product 1 . An irreducible graph is one whose pseudofactorizations always include itself. In their work on unweighted graphs, Graham and Winkler [13] found that every connected, unweighted graph has a unique canonical pseudofactorization into irreducible graphs, called its canonical pseudofactors (Figure 2b).
Sheridan et al. [25] generalized the notion of pseudofactorization to minimal weighted graphs. In close analogy to unweighted graphs, they showed that any connected minimal graph has a unique canonical pseudofactorization into irreducible minimal graphs, and that the canonical pseudofactorization can be found in polynomial time. To do so, they made use of the Djoković-Winkler relation θ on the edge set of a graph, and its transitive closureθ (Figure 2c). In particular, they showed that, given any minimal graph, there is a bijection between its equivalence classes underθ and its canonical pseudofactors.

Isometric embeddings of graphs into hypercubes and Hamming graphs
A consequence of Graham and Winkler's work [13] on the canonical pseudofactorization of unweighted graphs is that an unweighted graph permits an isometric embedding into a Hamming graph if and only if every canonical pseudofactor is a complete graph.
For weighted graphs, work on finding isometric embeddings has been confined to isometric embeddings into hypercubes. In general, determining if an isometric embedding into a hypercube exists for an arbitrary weighted graph is NP-hard [6]. Efficient (i.e. polynomial-time) methods for determining hypercube embeddability are known for limited classes of weighted graphs.
Shpectorov [27] characterized all graphs with uniform edge weights that could be isometrically embedded into a hypercube, showing that each must be an isometric subgraph of a Cartesian product of complete graphs, cocktail party graphs, and half-cube graphs. Such graphs may be recognized in polynomial time [15,14,28]. Additional weighted graphs for which the existence of isometric embeddings into hypercubes may be determined in polynomial time include line graphs and cycle graphs [7], as well as graphs whose distances are all in the set {x, y, x + y} for integers x, y at least one of which is odd [20].
With weighted graphs the isometric embedding of a graph may no longer be unique, as noted previously (e.g., Figure 1c). A graph with a unique isometric embedding into a hypercube is said to be l 1 -rigid, and Deza and Laurent [7] showed that any uniformly weighted l 1 -rigid graph must be an isometric subgraph of a uniformly weighted half-cube. Deza and Laurent also considered counting the number of non-equivalent isometric embeddings for uniformly weighted complete graphs, and showed that K 4 with uniform edge weights of integer 2k always has k + 1 unique isometric embeddings into hypercubes [19].

Our results
In this work, we develop a formal relationship between pseudofactorization and isometric embeddings of minimal weighted graphs into unweighted Hamming graphs, called Hamming embeddings. All of our results may also be extended to isometric embeddings into hypercubes, called hypercube embeddings. One of the two main results of this paper is the following theorem, which states that a minimal graph G permits a Hamming embedding if and only if each of its canonical pseudofactors permits a Hamming embedding. This result may be contrasted with the unweighted case [13], in which each canonical pseudofactor must be a complete graph. Theorem 1.1 is proven by Theorem 3.4 and Corollary 3.5 in Section 3. We briefly sketch the proof and the novel contributions necessary for it here. A Hamming embedding of weighted graph G = (V (G), E(G), w G ) can be written as a mapping η : V (G) → Σ m , where m is the embedding dimension, Σ is the embedding alphabet, and the distance between two elements of Σ m is given by Hamming distance. η may be partitioned, that is, the columns may be grouped to form embeddings of lower dimension (though these are not generally isometric). The second main result of this manuscript is a proof of existence for a special canonical partition of η that provides isometric Hamming embeddings for each canonical pseudofactor of G.
be a minimal weighted graph and η a Hamming (hypercube) embedding of G. Let the canonical pseudofactors of G be the graphs G 1 , . . . , G n . Then there exists a partition of η into embeddings η 1 , . . . , η n such that η i forms a Hamming (hypercube) embedding of G i . Theorem 1.2 is proven by Theorems 3.2 and 3.3. To prove Theorem 1.1, we use Theorem 1.2 to show that if G is Hamming embeddable then its pseudofactors are also Hamming embeddable. The converse is easily shown to be true, by concatenating Hamming embeddings of the canonical pseudofactors. To construct the canonical partition of η, we introduce a novel relation on the coordinates of η = (η 1 , . . . , η m ), called γ. Informally, two coordinates are related by γ if the corresponding digits of η change across some edge in E. The transitive closure of γ is an equivalence relationγ, and its equivalence classes define a partition of the digits of η, which is the canonical partition of η (Figure 2c-d). Much of our effort is spent proving the existence of a bijection between the equivalence classes underθ (i.e. sets of edges) and the equivalence classes underγ (i.e. sets of coordinates), which we use to construct a bijection between the canonical pseudofactorization of G and the canonical partition of any Hamming embedding of G. As a final step, we prove that the embeddings of this partition form Hamming embeddings of each canonical pseudofactor ( Figure 2e).
Using Theorem 1.2, we are also able to prove the following result on the number of non-equivalent Hamming embeddings or hypercube embeddings of G. We define equivalence of two Hamming embeddings in the same way as Winkler in [30]; the formal definition is given in Section 2. Informally, two Hamming embeddings are equivalent if they can be made identical by permuting coordinates or coordinate values (i.e., swapping some number of η i and η j and/or swapping the values of a particular η i ). The following theorem is proven by Corollary 3.6. Theorem 1.3. Given a minimal weighted graph G, the number of non-equivalent Hamming embeddings of G is the product of the number of non-equivalent Hamming embeddings of each of its pseudofactors. Similarly, the number of non-equivalent hypercube embeddings of G is the product of the number of nonequivalent hypercube embeddings of each of its pseudofactors.
These theorems imply an important structure of any Hamming embedding of a graph G: such an embedding must be equivalent to a concatenation of Hamming embeddings for each canonical pseudofactor of G. As a consequence, the existence of a Hamming embedding of G implies one for each pseudofactor. The converse is easily shown to be true also. In practice, these results mean that we may recognize graphs that do not  Figure 2: (a) Illustration of the Cartesian graph product. Edge colors indicate correspondence between edges in the factor and product graphs. If edges are weighted, two edges of the same color will have the same weight. (b) This graph product is isometrically embeddable in a product of three irreducible graphs (K 3 , K 2 , and K 2 ), which form its canonical pseudofactorization. (c) A weighted graph, with purple edges of weight 4 and orange edges of weight 2. Edge colors also indicate equivalence classes under the transitive closureθ of the Djoković-Winkler relation. (d) A hypercube embedding of this graph, with digits colored to indicate equivalence classes underγ.γ is the transitive closure of γ, which relates coordinates whose digits change together across some edge. (e) Our results show that the hypercube embedding in (d) may be partitioned into a hypercube embedding for each of the two canonical pseudofactors. The same is true of any Hamming embedding of a minimal graph. permit a Hamming embedding by analyzing the pseudofactors, which may be significantly smaller. They also allow us to extend polynomial-time results for determining Hamming or hypercube embeddability of a graph to graphs whose pseudofactors can be determined as Hamming or hypercube embeddable in polynomial time. These include Cartesian products of line graphs, cycle graphs, graphs with distances in {x, y, x + y} for integers x, y at least one odd, and graphs with uniform edge weights [7,20,27], along with any other graphs later found to be Hamming or hypercube embeddable. Significant additional work remains in characterizing classes of irreducible weighted graphs for which Hamming or hypercube embeddings may be constructed efficiently. However, our work significantly eases the problem of finding Hamming or hypercube embeddings for graphs with nontrivial pseudofactorizations, and is also a step forward in better understanding isometric embeddings of weighted graphs into more complex destination graphs.

Preliminaries
In this paper, all graphs are finite, connected, and undirected, and we use V (G), E(G), and w G : E(G) → Z >0 to denote the vertex set, edge set, and weight function of a graph G, respectively. G being unweighted is equivalent to w G (e) = 1 for all e ∈ E(G). An edge between vertices u, v ∈ V (G) is written uv or vu; since all edges are undirected, uv ∈ E(G) ⇐⇒ vu ∈ E(G). The distance from u to v, u, v ∈ V (G), is the minimum edge weight sum along a path from u to v, and is given by the shortest path metric denoted The following definition is due to Sheridan et al. [25]: A graph G is a minimal graph if and only if every edge in E(G) forms a shortest path between its endpoints. That is, In this manuscript, we assume all graphs are minimal. Note that any unweighted graph is minimal and that any non-minimal graph may be made minimal by removing any edges not satisfying the condition in Definition 2.1.
The Cartesian graph product of one or more graphs G 1 , . . . , G n is written G = G 1 × · · · × G n or G = n i=1 G i . G is defined as V (G) = V (G 1 ) × · · · × V (G n ), with two vertices (u 1 , . . . , u n ) and (v 1 , . . . , v n ) adjacent if and only if there is exactly one such that u v ∈ E(G ) and u i = v i for all i = , and w G (uv) = w G (u v ) for chosen as above (Figure 2a). The Cartesian graph product has the following important distance property: where u = (u 1 , . . . , u n ) and v = (v 1 , . . . , v n ). This implies that any path in G can be decomposed into a set of paths in the G i , with the path length in G equal to the sum of the path lengths in the G i .
A graph embedding π : V (G) → V (G * ) of a graph G into a graph G * maps vertices of G to those of G * . If π satisfies d G (u, v) = d G * (π(u), π(v)) for all u, v ∈ V (G), then π is an isometric embedding. When such a π exists, we say that G → G * . For convenience, we let d π (u, v) = d G * (π(u), π(v)).

every vertex in G *
i is in the image of π i , 1 ≤ i ≤ n, and 4. every edge u i v i in G * i equals π i (u)π i (v) for some uv ∈ E(G) then we say the set {G * 1 , . . . , G * n } is a pseudofactorization of G and refer to each G * i as a pseudofactor. A graph G is irreducible if all its pseudofactorizations include itself as a pseudofactor. A pseudofactorization into irreducible graphs is called an irreducible pseudofactorization. For convenience, we assume that a pseudofactorization does not include K 1 , except when G = K 1 .
Informally, the definition of pseudofactorization requires both that G be isometrically embeddable into G * and that edges be preserved within this embedding. This second condition is a natural one for manipulating graph structures, but may be less applicable to other situations (e.g., finite metric spaces). The final two conditions ensure that there are no unnecessary vertices and edges in the pseudofactors (or any graph would be a pseudofactor of the graph in question, as G is an isometric subgraph of G × H for any graph H).
Sheridan et al. [25] showed that an irreducible pseudofactorization of a weighted graph G is unique. This pseudofactorization is called its canonical pseudofactorization, and the corresponding isometric embedding implied by the first condition of Definition 2.2 is its canonical embedding. The authors used the Djoković-Winkler relation θ, which we restate here as has been defined elsewhere [13,25]. For a graph G, two edges in the graph uv, ab ∈ E(G) are related by θ if and only if: We note that θ is symmetric and reflexive. Let the equivalence relationθ be the transitive closure of θ.
A constructive algorithm [25] proves the existence of the canonical pseudofactorization. This algorithm creates exactly one canonical pseudofactor from each element of E(G)/θ, the set of equivalence classes underθ. We make the following note about the canonical pseudofactors produced by this algorithm: Theorem 2.3. Consider the canonical pseudofactorization of G, {G 1 , . . . , G n }, as constructed by Algorithm 1 of [25], and assume each G i was constructed from equivalence class E i ∈ E(G)/θ. Let π = (π 1 , . . . , π n ) be the canonical embedding of G into n i=1 G i . For u, v ∈ V (G) and a path P from u to v, let P j be the subsequence of edges in P that are in E j . Then there is a path in G i of length equal to the sum of the edge weights in P j .
Proof. By inspection of Algorithm 1, two vertices connected by an edge not in E j will be identified in G j . Since π is an isometric embedding of G, where the final equality is because, by the previous sentence, all summands are zero except when i = j. As a result, for each uv ∈ P j there is a path from π j (u) to π j (v) of length w G (uv). Any edges in P but not P j do not change the value of π j . So adjacent edges in P j share an endpoint, and there is a path of length equal to the sum of the edge weights in P j .
Finally, we introduce the following notation for our discussions of Hamming graphs. If H is a Hamming graph H, then V (H) = Σ m , where Σ is the alphabet and m the dimension of H, and distance in H is given by the Hamming distance between pairs of vertices. H is a hypercube graph if |Σ| = 2. For Hamming or hypercube graph H, an isometric embedding η : V (G) → V (H), is a Hamming or hypercube embedding, respectively. We use subscripts to refer to individual letters in the image of η = (η 1 , . . . , η m ) or, equivalently, η = η 1 · · · η m . The indices [m] of η are its coordinates, where [m] is the first m positive integers, and each η i , 1 ≤ i ≤ m, is a digit. Two for more embeddings η 1 , . . . , η n of dimensions m 1 , . . . , m n may be concatenated, forming an embedding η = η 1 · · · η n = η 1 1 · · · η 1 m 1 · · · η n 1 · · · η n mn . Two Hamming embeddings η, η are equivalent if there exists a permutation σ of the m coordinates and m functions β i , 1 ≤ i ≤ m, such that η (u) = β 1 (η σ(1) (u)) · · · β m (η σ(m) (u)) for all u ∈ V (G). A Hamming embedding of G is unique if it is equivalent to all other Hamming embeddings of G. We assume there are no unnecessary digits in η (i.e., every digit changes across some edge), which is analogous to our assumption that K 1 is not used in any pseudofactorization.
For any two vertices u, v ∈ V (G), we define the function D η as follows: noting that a graph G with Hamming embedding η : When uv is an edge, we say that the digits indicated by D η (u, v) change across uv. We also introduce a relation γ, which relates two coordinates of an embedding if both corresponding digits change across any edge: Letγ be the transitive closure of γ. Since γ is symmetric and reflexive,γ is an equivalence relation.

Structure of Hamming embeddings of weighted graphs
In this section, we begin by constructing a bijection between the canonical partition of any Hamming embedding of G and its set of canonical pseudofactors. This result is used to prove the two main findings of the paper: Theorem 3.3, which proves that the canonical partition of a Hamming embedding of G forms a Hamming embedding for each canonical pseudofactor; and Theorem 3.4, which proves that G permits a Hamming embedding if and only if each of its pseudofactors also permits a Hamming embedding. Proof. To see that uvθ u v ⇒ jγ j , observe that j ¡ ¡ γ j implies that D η (u, v) and D η (u , v ) are disjoint. Thus, because each summand is nonzero only if both η s (u) = η s (v) and η s (u ) = η s (v ). So j ¡ ¡ γ j ⇒ uv ¡ θ u v , and uv θ u v ⇒ jγ j . If instead uvθ u v then some sequence of edges (e i ) l i=1 satisifes uv θ e 1 θ · · · θ e l θ u v , and the transitivity ofγ implies jγ j .
To prove jγ j ⇒ uvθ u v , let S = D η (u, v) ∩ D η (u , v ), the set of all coordinates that change across both uv and u v . We prove the statement in two cases: Case 1 (|S| > 0): Consider any path P with l edges, beginning with uv and ending with u v , l ≥ 2. We show by induction on l that |S| > 0 ⇒ uvθ u v . As a base case, consider l = 2 and without loss of generality let P = (u, v = u , v ). As above, we consider with the sum restricted to coordinates s ∈ S for which the summand is nonzero.
Thus, each summand is at least +1 and the summation is at least +|S| and |S| > 0 ⇒ uv θ u v . Now, consider the case l > 2 and P = (u 0 = u, u 1 = v, . . . , u l−1 = u , u l = v ). If every edge u i−1 u i , 1 < i < l, has S and D η (u i−1 , u i ) disjoint, then η s (v) = η s (u ) for all s ∈ S and as in the base case we have |S| > 0 ⇒ uv θ u v . If some edge u i−1 u i has S and D η (u i−1 , u i ) not disjoint, then consider the subpaths P 1 = (u 0 , u 1 , . . . , u i ) and P 2 = (u i−1 , u i , . . . , u l ), with l 1 and l 2 edges, respectively. Clearly 2 ≤ l 1 , l 2 < l, so by induction we conclude that uvθ u i−1 u iθ u v .
Case 2 (|S| = 0): We are given jγ j , so construct a sequence of coordinates j 0 = j, . . . , j l = j such that j i−1 γ j i for all 1 ≤ i ≤ l. For each pair of coordinates j i−1 , j i there is some edge e i across which both η j i−1 and η j i change. By Case 1, we have uvθ e 1 , e lθ u v , and e i−1θ e i for 1 < i ≤ l. Thus, uvθ u v as desired.
Theorem 3.2. Let G be a weighted graph and η an m-dimensional Hamming embedding of G. Then there is a bijection between E(G)/θ and [m]/γ. It follows that there is a natural bijection from the set of canonical pseudofactors of G to the canonical partition of η.
Proof. We first construct a bijection from E(G)/θ to [m]/γ. Let [uv]θ ∈ E(G)/θ contain uv ∈ E(G) and [j]γ ∈ [m]/γ contain j ∈ [m]. Then we consider the mapping f 2 : γ, so jγ j and thus uvθ u v . f 2 is surjective because each digit of η changes over some edge. This proves the first assertion of the theorem. For the second assertion, we use the bijection between E(G)/θ and the canonical pseudofactorization (see Section 2) that takes each G i to the E i ∈ E(G)/θ that was used to construct it, where {G 1 , . . . , G n } is the canonical pseudofactorization. We also have a bijection f 3 from [m]/γ to the canonical partition of η, since the elements of [m]/γ were used to form that partition.
Thus, the mapping f = f 3 • f 2 • f 1 is a bijection from the canonical pseudofactors of G to the canonical partition of η.
Theorem 3.3. Let weighted graph G have canonical pseudofactors G 1 , . . . , G n , with π : V (G) → V ( n i=1 ) the canonical embedding of G. Let η be an m-dimensional Hamming embedding of G with canonical partition η 1 , . . . , η n . Assume without loss of generality that the natural bijection of Theorem 3.2 maps G i to η i for each i, 1 ≤ i ≤ n. Then there is an embedding η i implied by η i = η i • π i , which is a Hamming embedding of G i for each i, 1 ≤ i ≤ n.
Fix any two vertices u, v ∈ V (G) and consider a shortest path P from u to v. For each pseudofactor G i , let E i be the equivalence class underθ from which G i was generated and let c i be the sum of the edge weights for edges along P that are in E i . By Theorem 2.3, P implies a path in G i of length c i , each d π i (u, v) ≤ c i . Further, each edge along P contributes to exactly one c i , so we have where the second equality is due to the fact that π is an isometric embedding. Thus each d π i (u, v) = c i . Now take η i , for which we know, based on the construction of Theorem 3.2, that w G (e) digits change across any edge e ∈ E i and no digits change across any other edge. Then d η i (u, v) ≤ c i . In fact, we have where again the second equality is because η is an isometric embedding. As before, this implies that We construct a Hamming embedding η i for G i that satisfies η i = η i • π i . π i is not unambiguously invertible because multiple nodes in V (G) may map to the same u i in G i . However, we may let π −1 i : Proof. Let π : V (G) → n i=1 V (G i ) be the canonical embedding of G, with π = (π 1 , . . . , π n ). If G is Hamming embeddable then by Theorem 3.3 we may construct Hamming embeddings of each pseudofactor.
If every pseudofactor is Hamming embeddable, then let η i be a Hamming embedding for pseudofactor G i .
So we may concatenate the η i to form η such that where the final equality is due to the fact that π is an isometric embedding of G into n i=1 G i . Thus, η is a Hamming embedding of G. Proof. If G has a hypercube embedding η, then each element of the canonical partition of η is also a hypercube embedding. Thus each canonical pseudofactor of G is hypercube embeddable because it has a hypercube embedding formed from an element of the canonical partition of η. Conversely, if each canonical pseudofactor of G has a hypercube embedding, these may be concatenated to form a hypercube embedding of G.
Corollary 3.6. Given a weighted graph G, the number of non-equivalent Hamming embeddings of G is the product of the number of non-equivalent Hamming embeddings of each of its pseudofactors. Similarly, the number of non-equivalent hypercube embeddings of G is the product of the number of non-equivalent hypercube embeddings of each of its pseudofactors.
Proof. Let π be the canonical embedding of G, π : V (G) → V ( n i=1 G i ), and π = (π 1 , . . . , π n ). Take any two non-equivalent Hamming embeddings η and ζ of G. Each element η i of the canonical partition of η corresponds to a Hamming embedding η i of G i , with η i = η i • π i . This is similarly true of ζ. Now if, for all 1 ≤ i ≤ n, η i is equivalent to ζ i , then each η i can be made identical to ζ i by permuting coordinates and coordinate values. Because η i = η i • π i and ζ i = ζ i • π i , this implies that η can be made identical to ζ by the same process, so η and ζ are equivalent. Thus, non-equivalent η and ζ must have some η i not equivalent to ζ i . That is, any non-equivalent η and ζ will correspond to Hamming embeddings of the G i that are distinct under equivalence, so the product of the number of non-equivalent Hamming embeddings of the G i is at least the number of non-equivalent Hamming embeddings of G. Now let η 1 , . . . , η n and ζ 1 , . . . , ζ n be such that each η i and ζ i are Hamming embeddings of G i . Let η i = η i • π i and ζ i = ζ i • π i , and consider the concatenations of the η i and the ζ i , η = η 1 · · · η n and ζ = ζ 1 · · · ζ n . Note that η and ζ form Hamming embeddings of G. If η and ζ are equivalent, then η may be made identical to ζ by permuting coordinates and coordinate values. Note that any such permutation must map each coordinate in η i to a coordinate in ζ i , because the corresponding digits necessarily change across the same edges. This allows the permutation from η to ζ to be decomposed into permutations from η i to ζ i , so each η i and ζ i must be equivalent. From this, we conclude that, for any 1 ≤ i ≤ n, if η i and ζ i are not equivalent then their corresponding η and ζ generated by the above process are also not equivalent. This indicates that the number of non-equivalent Hamming embeddings of G is not less than the product of the number of non-equivalent Hamming embeddings of the G i . This completes the proof. This can be proven identically for counting hypercube embeddings, noting that if η and ζ are hypercube embeddings then each element of their canonical partitions is also a hypercube embedding.

Conclusion
Weighted graphs are capable of representing a much richer variety of structures than unweighted graphs. Yet the added complexity of weighted graphs has made it difficult to develop a unified, general theory for understanding isometric embeddings of weighted graphs into various destination graphs of interest, such as unweighted Hamming graphs. Here, we have expanded our understanding of isometric embeddings by relating the pseudofactorization of a minimal weighted graph to its Hamming embeddings, proving that every Hamming embedding is simply a concatenation (or equivalent to a concatenation) of Hamming embeddings for each pseudofactor. Although a polynomial-time algorithm for deciding hypercube embeddability is unlikely to exist [6,17,2], this eases the task of finding Hamming embeddings, and of proving their non-existence, in cases where the graph has multiple non-trivial pseudofactors. Future work may further characterize the classes of graphs for which we can decide Hamming or hypercube embeddability in polynomial time.
We hope this work also spurs investigation into isometric embeddings of weighted graphs into arbitrary unweighted Cartesian graph products, as opposed to Hamming graphs specifically. In the context of Hamming embeddable graphs, our results imply a hierarchical decomposition of a minimal weighted graph into a Cartesian graph product, whereby a graph may be decomposed first into a Cartesian product of weighted pseudofactors and then each pseudofactor may be individually decomposed into a Cartesian product of (unweighted) complete graphs. An intuitive extension beyond Hamming graphs would be to establish a similar hierarchy for all isometric embeddings of minimal weighted graphs. Such a hierarchy would be an appealing and exciting result, but remains to be proven.