A "trie" is a data structure that converts "sentences" of symbols into a tree structure. In a trie all sequences ("n-grams") up to a certain length that appear in a "sentence" have as their parent "most" of that -gram, that is, all but the rightmost element of the original -gram. One also generally stores information on the number of times that a given -gram appears as the child of other -grams. Tries are useful for many purposes, including searching and finding "collocations", that is, -grams that appear more frequently than would occur randomly given their constituent parts.
In this Demonstration you create "sentences" by selecting an elementary cellular automaton rule and then choosing some rows of its evolution. Each row represents a sentence (although unlike linguistic sentences, the rows are "periodic", in the sense that the right end is connected with the left end). You also select the maximum size of the -grams you wish to appear in the trie. The system responds with a visualization of the trie as a network in which the nodes are the -grams (labeled in purple with the number of times they are hit by an incoming edge) and the thickness of the edges likewise reflects the number of times one particular -gram follows another.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


There is nothing particularly special about using a cellular automaton to generate the sentences or the use of a binary alphabet. The alphabet could be linguistic symbols or words and the stream of "text" could be words or true sentences.
Snapshot 1: where the sentences have lots of patterns that appear far more frequently than mere chance, the trie reflects this with fewer branches
Snapshot 2: a trie for rule 110
Snapshot 3: a trie for a cellular automaton with simple behavior
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students. »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+