🔤 Aho–Corasick Algorithm Explained
Interactive automaton visualization matching multiple pattern strings against a scrolling input text simultaneously, letting users edit the pattern dictionary and step through failure-link transitions as matches are found.
A 3D trie automaton radiates outward from a root node, its teal "goto" edges spelling out a dictionary of patterns and orange failure-link arcs showing how the algorithm falls back without ever rescanning the input.
🔬 What It Demonstrates
All patterns share one trie built from their common prefixes. Failure links, computed once by breadth-first search, redirect a mismatch to the longest suffix of the current match that is still a valid prefix — so the whole dictionary is matched in a single linear pass over the text.
🎮 How to Use
Edit the pattern dictionary and input text, then build the automaton. Press Play or Step to watch the glowing cursor walk goto edges (green) and failure links (orange) character by character, lighting up gold-ringed states whenever a pattern is matched.
💡 Did You Know?
Aho–Corasick runs in time proportional to the input length plus the number of matches — completely independent of how many patterns are in the dictionary — which is why it still powers many antivirus and intrusion-detection signature scanners today.
Interactive automaton visualization matching multiple pattern strings against a scrolling input text simultaneously, letting users edit the pattern dictionary and step through failure-link transitions as matches are found.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install