I have a dictionary text file being input into a graph. The program asks the user how many letters they want to use, then there is a conditional statement, the code only inputs words (vertices) that are x letters long.
Exmaple: if they put 3, the vertices in the graph will be "ban", "bet", "bit"....etc;
1 2 3 4 5 6 7 8 9 10 11 12
|
while(text.good())
{
getline(text,line);
if(line.length() == x)
{
G.addVertex(line);
}
}
|
however, now i need to add edges between words that are ONLY 1 character different.
Example: "bat" and "Cat" "dig" and "dug". i need to do that with every vertex in the graph.
Any idea how to do this? I have some code that implements some basic graph functions, like moving, adding vertices, edges, showing edges, and even comparing two strings and getting their number of differences. so if you need to see any of that, i can include it. but i just need a general direction on what to do with this or even how to.