Skip to Main Content
There are many ways to represent spanning trees in genetic algorithms (GAs). Among them are Cayley codes, which represent each tree on n vertices as a string of (n-2) integers from the set [1,n]. In 2003, Thompson showed that the Dandelion Code, a Cayley code with high locality, offers consistently better performance in a GA than all other known Cayley codes, including the Prüfer Code and the Blob Code. In this paper, we study the Dandelion Code and its properties. We give linear-time implementations of the decoding and encoding algorithms, and prove that the representation has bounded locality and asymptotically optimal locality, unlike all other known Cayley codes. We then modify the Dandelion Code to create bijective spanning tree representations for graph topologies other than the complete graph. Two variations are described: the bipartite Dandelion Code (for encoding the spanning trees of a complete bipartite graph) and the Rainbow Code (for encoding the spanning trees of a complete layered graph). Both variations inherit the Dandelion Code's desirable properties, and have the potential to outperform existing GA representations for computationally hard transportation problems (including the Fixed Charge Transportation Problem) and multistage transportation problems, particularly on large instances.