Trie implementation based on a minimal automaton.
Node.js trie implementation based on a Minimal Acyclic Finite-State Automata.
Implementation based on "Incremental Construction of Minimal Acyclic Finite-State Automata" by Jan Daciuk, Stoyan Mihov, Bruce W. Watson and Richard E. Watson.
npm install dtrie
Construct a new node.
Node's id, unique to each node.
Return true if this node has a child for the given transition.
Return the node child.
Check if a path exists from this node to a terminal node.
Return true if the current node is a terminal node.
This class is a subclass of Node.
Construct a new automata.
Populate the automata from an alphabetically sorted list of lowercase words. This method should only be called once per automata.
Return true if the automata recognize the given word.
Return the number of nodes in the automata.
This code is free to use under the terms of the MIT license.