Graph Golf

The Order/degree Problem Competition

Problem statement

Update 2019-07-29


The order/degree problem with parameters n and d: Find a graph with minimum diameter over all undirected graphs with the number of vertices = n and degree ≤ d. If two or more graphs take the minimum diameter, a graph with minimum average shortest path length (ASPL) over all the graphs with the minimum diameter must be found.

The order/degree problem on a grid graph with a limited edge length r: Do the same as above, but on a w × h grid in a two-dimensional Euclidean space, keeping the lengths of the edges ≤ r in Manhattan distance. Here a "grid" implies that (1) the vertices are located at integer coordinates and (2) the edges run along the grid lines. Note that (3) a vertex is not necessarily connected to its nearest neighbors and (4) an edge may change its direction at a grid point but must not run diagonally.


Let us show examples for the order/degree problem with parameters n = 16 and d = 4. The figure illustrates three examples of 4-regular graphs with 16 nodes. The diameter of the first and the second graphs is 3, while that of the third one is 4. Thus, we should select the first or the second one. Next, we compare the average shortest path length (ASPL) of those two graphs. Since the ASPL of the first one is smaller, this is the best solution of the problem among the three.

Why order/degree problem?

Graph design has a rich variety of application fileds of computer systems. In particular, it is just meeting a network design of future supercomputers and future high-end datacenters in terms of hop counts [SOCC11] [ISCA12] [SC14], since their networks are topologically modeled as undirected regular graphs. Low latency is preconditioned on small hop counts, but existing network topologies have hop counts much larger than theoretical lower bounds. Therefore, computer network designers desire to find a graph that has a small number of hops between any pair of vertices. The same solution is beneficial for desining such a micro network, though the layout of a graph on two-dimensional surface (on a chip) must be considered [MICRO07] [DATE14] [MICRO14].

Why not degree/diameter problem?

The degree/diameter problem (DDP) has been studied for decades and consists in generating the largest possible graph given degree and diameter constraints, striving to approach theoretical upper bounds [DDP-wiki]. However, DDP solutions may not be directly usable for network topologies in supercomputer and high-end datacenter systems because they are for particular number of compute nodes, whereas the number of nodes in a real system is determined based on practical considerations, e.g., budget.

Lower bound of diameter & ASPL

For a general graph with order n and degree d, the lower bound Kn,d on diameter k is computed as

Similarly, the lower bound Ln,d on ASPL l is computed as

For a grid graph, a tighter lower bound can be calculated by the algorithm shown in [Nakano 2016]. We employ this tighter lower bound for the grid graph category of the competition.

Programs for calculating those lower bounds are provided below.


A Python script that generates a regular random graph and calculates its diameter and ASPL is provided here. This may be a good starting point if you are new to creating graphs.

A C program that generates a grid graph and a Perl script that calculates the tighter lower bound of diameter and ASPL of a grid graph are contributed by Koji Nakano and Daisuke Takafuji.

For a faster calculation of ASPL, a C++ program was developed by Ryuhei Mori, and an MPI-based parallel program was developed by Masahiro Nakao.