First 5 minutes of hell
A torus is similar to mesh (but the corners are wrapped and connected to each other, something like a modulo (in dimension , the is adjacent to 0)
- is a line of vertices, is a ring of vertices
- torus is a Cartesian product of cycles (mesh is a Cartesian product of lines)
Properties:
- torus is regular, each vertex has now degree
- vertex count is the same as in meshes
- edge count is - each vertex adds an edge (divided by 2, as each edge is added twice)
- diameter: (now, we can take the shorter path along each axis - go straight, or take a shortcut around the corners)
- this is roughly 2 times less than meshes
- bisection width: two times the bisection width of the normal mesh (now I have to cut the wrapping edges as well)
- connectivity (better than meshes, there are no weak corners)
- torus is Hamiltonian (it is literally composed of cycles)
Vertex symmetry (big difference against meshes)
- the torus does not have corners technically, each vertex looks identical to every other
- now for effective planning of the route, I don’t need to know, where am I, only, where is the destination relative to me (in meshes, the routing differed based on (not)corner vertices)
Bipartiteness
- mesh is always bipartite (not always balanced), torus is bipartite iff every is even
- reason: a cycle is bipartite if is even and torus is bipartite iff all it’s factors are bipartite (Cartesian product)
- when all are even, the coloring works the same as in the mesh (the two color classes have equal size )
Hierarchical recursivity
- tori could be decomposed only to subtori of smaller dimensionality
- not subtori of the same dimensionality (same dimensionality, but smaller range breaks the cycles and creates lines → so it becomes a mesh actually)
Routing
- works in the same way as in meshes (by resolving the dimensions in a fixed order)
- for dimension , walk over dimension (other dimensions are frozen) until I match the destination value in this dimension, then I move onto dimension
- before going along the dimension, I need to pick a direction (since the dimension is actually a circle) and I need to pick the shorter path (subtract the source dimension value and destination value and see, which one takes shorter steps)
- I can rotate the dimension ordering (XYZ, ZXY, YXZ etc.), so I spread the traffic over the network and to increase fault tolerance (and still have a deadlock free design)
n-dimensional torus
Topic: the -dimensional torus as the wrapped variant of the mesh - an orthogonal direct topology built as a Cartesian product of cycles rather than linear arrays. Definition, structural properties (regularity, vertex symmetry, connectivity, bipartiteness, Hamiltonicity, hierarchical behaviour), vertex-disjoint paths, and dimension-ordered routing.
Definition of
The n-dimensional torus of side lengths - also called a toroidal mesh, wrapped mesh, or n-dimensional cycle - is defined by: The vertex set is identical to the mesh ; the edge set is the mesh edge set plus wraparound edges on every axis. Formally, adjacency in dimension uses modular arithmetic (addition modulo ) instead of ordinary addition.
Intuitively: take an -dimensional mesh and, for every linear sub-array along each axis, add one wraparound edge connecting its two endpoints.
Key parameters: Each dimension contributes to every vertex’s degree: one edge in each direction along that axis, even at coordinate and (which the wraparound handles). This makes the torus regular, unlike the mesh.
Torus as a Cartesian product
Analogous to the mesh, the torus decomposes by Cartesian product, but each factor is a cycle rather than a linear array: where is the 1-D torus (a cycle or ring on vertices).
Special cases:
- cycle/ring of length
-
k-ary n-torus - (the torus collapses to the hypercube when all side lengths are 2)
Consequently, meshes, tori, and hypercubes are all members of the same family of orthogonal topologies - the hypercube is the special case, and tori and meshes are its generalizations.
Comparison: torus vs mesh
Adding a very small number of extra edges (the wraparound) to the mesh has dramatic consequences:
Diameterandaverage distanceareapproximately halvedvs the equal-sided mesh (since you can now travel the short way around each cycle)Connectivityandbisection widthareapproximately doubledvs the equal-sided mesh- The torus becomes
regular(all vertices have degree ), whereas the mesh has vertices of degrees through - The torus becomes
vertex-symmetric(Theorem 22), whereas the mesh is not
Hierarchical behaviour
Unlike meshes, tori are not hierarchically recursive: a torus cannot be decomposed into sub-tori of the same dimension. However:
- Cartesian product is still the constructor:
- Tori contain
sub-tori of smaller dimensionality(e.g., contains as sub-torus by fixing one coordinate)
The failure of same-dimension recursivity follows from the wraparound: you cannot take a “sub-arc” of a cycle and get another cycle - you get a linear array instead, which is a mesh, not a torus.
Vertex symmetry (Theorems 21, 22)
Theorem 21: the 1-D torus is vertex-symmetric. Constructive proof: for any , define the cyclic shift
- Trivially a bijection
- Adjacency preservation from commutativity and associativity of modular arithmetic: Remark: besides cyclic shifts, also admits
mirror symmetry.
Theorem 22: is vertex-symmetric, with automorphisms being translations (vector shifts). Proof: immediate corollary of combined with Theorems 5, 7, and 21. The automorphisms are coordinate-wise cyclic shifts: for some translation vector . Any vertex can be mapped to any other by choosing the right translation.
Contrast with meshes: meshes fail vertex symmetry because corner vertices have lower degree than interior ones - by Theorem 7(2), vertex symmetry implies regularity, and meshes are not regular. Tori, by adding wraparounds, repair this degree irregularity and become vertex-symmetric.
Bipartiteness (Theorem 23)
Theorem 23: is bipartite iff all dimensions have even size (and balanced in that case). In contrast, is always bipartite.
Proof idea:
- Two vertices of a torus are adjacent iff they differ by one in modular arithmetic in exactly one coordinate. The 2-coloring is
parity of the sum of coordinates modulo 2- moving to any neighbor flips this parity by (which in turn flips its parity) - For the mesh, this colouring always works because non-modular steps always flip parity
- For the torus, the wraparound in dimension connects to : if is odd, this edge connects two vertices of the
sameparity (since and an even number have opposite parities… actually differ by , which is odd so parity differs - wait, the condition is more subtle). The core fact is thatodd-sized cycles are not bipartite. So the torus is bipartite iff all its cycle factors are bipartite, which requires all to be even
When all are even, the torus is balanced bipartite with vertices in each color class.
Hamiltonicity
Tori are always Hamiltonian. Every 1-D torus (cycle) is trivially Hamiltonian, and Hamiltonicity propagates through Cartesian products of cycles.
Contrast with meshes: a mesh is Hamiltonian only if at least one side has even length; otherwise it admits only a Hamiltonian path, not a circuit.
Connectivity
Tori have optimal connectivity: Every vertex has degree , and this matches both vertex and edge connectivity. Tori have no “bottleneck” vertices or edges.
Vertex-disjoint paths (Lemma 24)
Lemma 24 generalizes the hypercube result (Lemma 20) to tori. Let and be two vertices of with all , which WLOG differ in the first dimensions. Define the Manhattan distance in dimension i: (i.e., the shorter of the two cyclic offsets, choosing to go either forward or backward around the cycle). The total Manhattan distance between and is: Then there exist vertex-disjoint paths distributed as follows:
- paths of length (shortest paths, one per dimension-order rotation)
- paths of length (detours through dimensions where and agree - “step aside” trick)
- the remaining paths of length for (these go the
long way aroundcycle rather than the short way - length penalty is )
This matches the optimal connectivity - for each vertex there are exactly vertex-disjoint paths reaching any other vertex, one per edge leaving that vertex.
Routing in a torus is like routing in Manhattan, using avenues or streets - except we have such dimensions, and each axis is a cycle so you can go either direction.
Routing in tori - dimension-ordered (XY / XYZ)
The basic shortest-path routing in tori is dimension-ordered routing, the direct analogue of mesh routing:
- 2-D torus:
XY routing- fix the destination’s X-coordinate first by traversing along the X-axis, then the Y-coordinate - 3-D torus:
XYZ routing- X first, then Y, then Z - general -D torus: dimensions fixed in a predetermined order
Key differences from mesh routing:
- In each dimension , choose the
shorter directionaround the cycle: forward () or backward (), whichever gives offset - The routing is still shortest-path: total hop count equals the Manhattan distance
Like e-cube routing on the hypercube, the fixed dimension order makes XY(Z) routing deadlock-free - no cyclic wait among dimensions can form. To produce vertex-disjoint parallel paths (for packet splitting), use different dimension orderings across paths, following the construction of Lemma 24.
Example parameters and practical importance
Tori are commercially successful:
- IBM BlueGene used
3-D tori - BlueWaters used
3-D tori - Fujitsu built a
6-D torus
You can build tori of any dimension - limited only by engineering creativity for the 3-D physical layout (racks form 2-D grids on the floor, stacked vertically - mapping higher-dimensional tori onto 3-D space requires cable routing tricks).
Among equal-sized meshes, tori, and hypercubes, the torus strikes the best trade-off: diameter smaller than the mesh but larger than the hypercube; density and bisection width likewise intermediate. Numerical example for :
| diameter | 17 | 10 | 8 |
| 640 | 768 | 1024 | |
| 32 | 64 | 128 |
Finally, optimal algorithms exist for many fundamental problems on tori, and tori interact well with dimension-ordered collective communication patterns - XY(Z) routing also drives broadcast, reduction, and all-to-all primitives.
Summary of parameters
Compact summary:
- Vertices: tuples with
- Edges: , wraparound via modular arithmetic in each dimension
- Regular: yes, -regular (so sparse when is constant - as typically assumed)
- Diameter: - roughly half the mesh’s diameter
- Connectivity: optimal,
- Bisection width: - double the mesh’s
- Vertex-symmetric: yes (Theorem 22, automorphisms are translations)
- Hamiltonian: always
- Bipartite: iff all are even (Theorem 23); balanced in that case
- Hierarchical recursivity:
noth.r. to same-dimension sub-tori, but is h.r. tolower-dimensionsub-tori; constructor is Cartesian product of cycles - Special cases: cycle;
- Vertex-disjoint paths between at Manhattan distance : paths, distributed in three length classes (Lemma 24)
- Routing: dimension-ordered (XY / XYZ), choose shorter direction around each cycle, deadlock-free
Potential exam questions
- Give the formal definition of the -dimensional torus : vertex set, edge set, and key parameters (, , diameter, degree, bisection width).
- Express the torus as a Cartesian product. What are the special cases , , and ?
- Compare meshes and tori: how do diameter, average distance, connectivity, bisection width, regularity, and vertex symmetry differ?
- Why is the torus regular while the mesh is not? How does regularity relate to vertex symmetry (via Theorem 7)?
- State and prove Theorem 21: the 1-D torus is vertex-symmetric. Construct the cyclic-shift automorphism and verify adjacency preservation.
- Derive Theorem 22 (vertex symmetry of the -D torus) as a corollary of Theorems 5, 7, and 21. What do the automorphisms look like?
- State Theorem 23: when is bipartite? What 2-coloring works? Why are meshes always bipartite but tori only sometimes?
- When is Hamiltonian? Contrast with the mesh, which is Hamiltonian only if at least one side has even length.
- Is the torus hierarchically recursive? Explain why it cannot be decomposed into same-dimension sub-tori, only into lower-dimension sub-tori.
- State Lemma 24 on vertex-disjoint paths in tori. Define
Manhattan distanceand total . How many vertex-disjoint paths exist between two vertices, and what are their length classes? Why does the count match ? - Describe
XY routingin a 2-D torus . Given and in , write out the XY-routed path. - Why is dimension-ordered routing in a torus deadlock-free?
- How does one choose between “forward” and “backward” along each cycle in torus routing? When are the two directions the same length?
- List commercial parallel computers that use torus-based topologies and state their dimensions (e.g., IBM BlueGene, BlueWaters, Fujitsu).
- Compare , , and for in terms of diameter, edge count, and bisection width. Which topology strikes the best cost/latency trade-off?