简体   繁体   中英

Graph representation of sliding puzzle

I need to represent a sliding puzzle that goes from 2x2 to 4x4 using graphs. I am aware that a state of the puzzle can represent a vertex and the other possibilities are connected with edges. I am not sure how to begin and how to create the vertices and the connections with edges. For example, a 3x3 puzzle has 9! vertices, but how can I create that graph in java?

You can use JGraphT library. Have a look at Graph interface implementations for the supported graphs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM