You can use the Ladders graph to play the Ladders game. In this two-player game, one player chooses a starting word and an ending word and the other player constructs a "ladder" between the two words.
A ladder is a sequence of words that starts at the starting word, ends at the ending word, and each word in the sequence (except the first) is obtained from the previous word by changing a letter in a single position.
For example, suppose the starting word is flour and the ending word is bread, then a ladder between these two words is: flour, floor, flood, blood, brood, broad, bread.
This is the link that will take you to a file called words.dat that contains 5757 five letter English words.
http://www.cs.uiowa.edu/~sriram/21/spring06/words.dat
This word list is the database that your program will use to construct the Ladders graph.
The Ladders graph should contain a vertex for every word in the file and an edge between every pair of vertices that differ in exactly one position.
To construct the graph, you should call the function addVertex on every word in the file and then the function addEdge for every edge you want to add.
After you have constructed the Ladders graph, let the program answer the following questions:
What is a word with maximum number of neighbors? Output such a word and all its neighbors.
What is a word with fewest numbers of neighbors? Output such a word and all its neighbors
السؤال:
كيف لي أن أجعل الكلمات التي تختلف في حرف واحد adjacent???
علما بأن ملف الكلمات مرتب على أساس أنها تختلف فيما بينها في حرف واحد
- قمت بتعبئة الفيرتكس في الجراف من الفايل