ArticleslgStudy

computer science

GADDAG

GADDAG is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand GADDAG rather than just read about it. In short: A GADDAG is a data structure presented by Steven Gordon in 1994, for use in generating moves for Scrabble and other word-generation games where such moves require words that "hook into" existing words. It is often in contrast to move-generation algorithms using a directed acyclic word graph (DAWG) such as the one used by Maven.

Key takeaways

  • GADDAG belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect GADDAG to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of GADDAG from memory before moving on to harder problems.

Reference excerpt

A GADDAG is a data structure presented by Steven Gordon in 1994, for use in generating moves for Scrabble and other word-generation games where such moves require words that "hook into" existing words. It is often in contrast to move-generation algorithms using a directed acyclic word graph (DAWG) such as the one used by Maven. It is generally twice as fast as the traditional DAWG algorithms, but take about 5 times as much space for regulation Scrabble dictionaries. Quackle, an open-source Scrabble program, uses a GADDAG to generate moves.

Description The name GADDAG comes from DAG for directed acyclic graph, prefixed by its own reverse. A GADDAG is a specialization of a Trie, containing states and branches to other GADDAGs. It is distinct for its storage of every reversed prefix of every word in a dictionary. This means every word has as many representations as it does letters; since the average word in most Scrabble regulation dictionaries is 5 letters long, this makes the GADDAG about 5 times as big as a simple DAWG.

Definition For any word in a dictionary that is formed by a non-empty prefix x and a suffix y, a GADDAG contains a direct, deterministic path for any string REV(x)+y, where + is used as a separator. (Any non-letter character could be used instead of + here.) For example, for the word "explain," a GADDAG will contain direct paths to the strings

e+xplain xe+plain pxe+lain lpxe+ain alpxe+in ialpxe+n nialpxe

This setup enables searching for a word given any letter that occurs in it.

Use in move generation Any move-generation algorithm must adhere to three types of constraints:

Board constraints: one may only build by 'hooking' onto existing letters of the board, and one may only place tiles on empty squares. Rack constraints: one may only place tiles with letters on one's rack. Dictionary constraint: all words resulting from the placement of tiles exist in the game's dictionary. DAWG-based algorithms take advantage of the second and third constraint: the DAWG is built around the dictionary, and is traversed using tiles in the rack. It fails, however, to address the first constraint: supposing one want to 'hook into' the letter P in HARPY, and the board has 2 spaces before the P, one must search the dictionary for all words containing letters from the rack where the third letter is P. This is inefficient when searching through the DAWG, as many searches through the trie will be fruitless. This is addressed by the GADDAG's storage of prefixes: by traversing the P branch of a GADDAG, one sees all words that have a P somewhere in their composition, and can "travel up" the prefix to form the word with tiles in the rack. To use the example from the § Definition section, searching for P turns up "pxe+lain". The letters between P and the + can be placed above the P on the board, and the rest below it (if space on the board permits).

See also Suffix Tree Trie Scrabble Prefix Hash Tree

References

Worked examples

Example 1 — a first encounter with GADDAG

Start with the simplest possible case. Write down what GADDAG claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to GADDAG before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about GADDAG ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of GADDAG

In research
GADDAG appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses GADDAG in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
GADDAG is common in secondary-school and first-year university syllabi. It links to neighbouring topics Game artificial intelligence, Graph data structures, Scrabble software, so understanding it makes those chapters shorter.
In everyday life
Look for GADDAG outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study GADDAG in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what GADDAG means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain GADDAG out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is GADDAG in simple terms?

A GADDAG is a data structure presented by Steven Gordon in 1994, for use in generating moves for Scrabble and other word-generation games where such moves require words that "hook into" existing words. It is often in contrast to move-generation algorithms using a directed acyclic word graph (DAWG)…

Why does GADDAG matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study GADDAG?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on GADDAG.

Tags

  • Game artificial intelligence
  • Graph data structures
  • Scrabble software
  • String data structures

Keep exploring