Sequentially Swapping Colored Tokens on Graphs

  • Katsuhisa YamanakaEmail author
  • Erik D. Demaine
  • Takashi Horiyama
  • Akitoshi Kawamura
  • Shin-ichi Nakano
  • Yoshio Okamoto
  • Toshiki Saitoh
  • Akira Suzuki
  • Ryuhei Uehara
  • Takeaki Uno
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10167)


We consider a puzzle consisting of colored tokens on an n-vertex graph, where each token has a distinct starting vertex and a set of allowable target vertices for it to reach, and the only allowed transformation is to “sequentially” move the chosen token along a path of the graph by swapping it with other tokens on the path. This puzzle is a variation of the Fifteen Puzzle and is solvable in \(\text{ O }(n^3)\) token-swappings. We thus focus on the problem of minimizing the number of token-swappings to reach the target token-placement. We first give an inapproximability result of this problem, and then show polynomial-time algorithms on trees, complete graphs, and cycles.



This work is partially supported by MEXT/JSPS KAKENHI Grant Numbers JP24106002, JP24106004, JP24106005, JP24106007, JP24220003, JP24700008, JP26330004, JP26330009, JP26730001, JP15K00008, JP15K00009, JP16K00002, and JP16K16006, the Asahi Glass Foundation, JST, CREST, Foundations of Innovative Algorithms for Big Data, and JST, CREST, Foundations of Data Particlization for Next Generation Data Mining.


  1. 1.
    Berlekamp, E.R., Conway, J.H., Guy, R.K.: Winning Ways for Your Mathematical Plays, 2nd edn. AK Peters, Natick (2004)zbMATHGoogle Scholar
  2. 2.
    Demaine, E.D., Hearn, R.A.: Playing games with algorithms: algorithmic combinatorial game theory. In: Games of No Chance 3, vol. 56, pp. 3–56. Cambridge University Press, Cambridge (2009)Google Scholar
  3. 3.
    Goldreich, O.: Finding the shortest move-sequence in the graph-generalized 15-puzzle is NP-hard. In: Goldreich, O. (ed.) Studies in Complexity and Cryptography. Miscellanea on the Interplay between Randomness and Computation. LNCS, vol. 6650, pp. 1–5. Springer, Heidelberg (2011). doi: 10.1007/978-3-642-22670-0_1 CrossRefGoogle Scholar
  4. 4.
    Kornhauser, D.M., Miller, G., Spirakis, P.: Coordinating pebble motion on graphs, the diameter of permutation groups, and applications. In: Proceedings of the 25th Annual Symposium on Foundations of Computer Science (FOCS), pp. 241–250 (1984)Google Scholar
  5. 5.
    Ratner, D., Warmuth, M.: The \((n^2 -1)\)-puzzle and related relocation problems. J. Symb. Comput. 10, 111–137 (1990)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Wilson, R.M.: Graph puzzles, homotopy, and the alternating group. J. Comb. Theory (B) 16, 86–96 (1974)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Yamanaka, K., Demaine, E.D., Ito, T., Kawahara, J., Kiyomi, M., Okamoto, Y., Saitoh, T., Suzuki, A., Uchizawa, K., Uno, T.: Swapping labeled tokens on graphs. Theoret. Comput. Sci. 586, 81–94 (2015)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Yamanaka, K., Horiyama, T., Kirkpatrick, D., Otachi, Y., Saitoh, T., Uehara, R., Uno, Y.: Swapping colored tokens on graphs. In: Dehne, F., Sack, J.-R., Stege, U. (eds.) WADS 2015. LNCS, vol. 9214, pp. 619–628. Springer, Heidelberg (2015). doi: 10.1007/978-3-319-21840-3_51 CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  • Katsuhisa Yamanaka
    • 1
    Email author
  • Erik D. Demaine
    • 2
  • Takashi Horiyama
    • 3
  • Akitoshi Kawamura
    • 4
  • Shin-ichi Nakano
    • 5
  • Yoshio Okamoto
    • 6
  • Toshiki Saitoh
    • 7
  • Akira Suzuki
    • 8
  • Ryuhei Uehara
    • 9
  • Takeaki Uno
    • 10
  1. 1.Iwate UniversityMoriokaJapan
  2. 2.Massachusetts Institute of TechnologyCambridgeUSA
  3. 3.Saitama UniversitySaitamaJapan
  4. 4.The University of TokyoMeguroJapan
  5. 5.Gunma UniversityKiryuJapan
  6. 6.The University of Electro-CommunicationsChofuJapan
  7. 7.Kobe UniversityKobeJapan
  8. 8.Tohoku UniversitySendaiJapan
  9. 9.Japan Advanced Institute of Science and TechnologyNomiJapan
  10. 10.National Institute of InformaticsChiyodaJapan

Personalised recommendations