Description
Expand an explicit compressed rooted trie edge table into stable insertion-code-unit nodes, validating complete unique-parent acyclic structure and unambiguous outgoing first characters; IDs are reallocated, not preserved.
A trie stores literal words as root-to-node character paths, with terminal flags marking complete words. A terminal can also have children, and an existing prefix path need not be a stored word. This family uses one UTF-16 code unit per ordinary edge, so code-unit length differs from a displayed character or Unicode code-point count.
Expand an explicit compressed rooted trie edge table into stable insertion-code-unit nodes, validating complete unique-parent acyclic structure and unambiguous outgoing first characters; IDs are reallocated, not preserved.
When to use this tool
Use this tool to expand an explicit compressed rooted trie edge table into stable insertion-code-unit nodes, validating complete unique-parent acyclic structure and unambiguous outgoing first characters; IDs are reallocated, not preserved.
How to use the tool and how it works
- Enter edgesJson, rootTerminal using the definitions below. Serialize JSON text fields in the decoded shape shown below.
- Run the operation. Resolve input-format errors before interpreting an output.
- Read result.nodes, using the stated boundary, ordering, sign and absence conventions.
Validate unique compressed destinations, distinct first-edge characters per parent and a complete acyclic root-zero edge forest. Reconstruct terminal words, preserving the separate root terminal flag, then rebuild an uncompressed trie from those words. Reject nonterminal leaves that would be lost.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| edgesJson | JSON array of {from,to,label,terminal} compressed edges. IDs are integers 0–127, destinations are nonroot and unique, and labels are nonempty strings of at most 127 UTF-16 units. | Text, at most 8,192 UTF-16 code units; narrower grammar/range rules also apply. |
| rootTerminal | Whether the root represents a stored empty word. | Boolean true or false. |
These decoded structures show the examples inside JSON text fields. Supply their serialized JSON strings as input.
{
"edgesJson": [
{
"from": 0,
"to": 2,
"label": "ab",
"terminal": true
}
]
} | Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.nodes | Creation-order root-zero trie node records {id,parent,character,terminal}. |
{
"input": {
"edgesJson": "[{\"from\":0,\"to\":2,\"label\":\"ab\",\"terminal\":true}]",
"rootTerminal": false
},
"output": {
"result": {
"nodes": [
{
"id": 0,
"parent": null,
"character": "",
"terminal": false
},
{
"id": 1,
"parent": 0,
"character": "a",
"terminal": false
},
{
"id": 2,
"parent": 1,
"character": "b",
"terminal": true
}
]
}
}
} Limitations and assumptions
- New uncompressed node IDs are creation-order IDs and need not preserve compressed IDs. Labels are 1–127 UTF-16 units and expansion must fit 128 nodes.
- Ordinary node tables have at most 128 nodes with distinct IDs 0–127, one root ID 0 with empty character and null parent, unique parent/character edges, complete acyclic parent links and a boolean terminal flag. Every nonroot character is exactly one UTF-16 code unit.
- Every declared outer field is required and unknown outer fields are rejected. Strings and JSON text have size limits, lists are bounded to 128 entries, and JSON nesting/node counts are bounded. Tighter operation-specific bounds stated above take precedence.
- Ordinary numeric outputs must be finite and within safe-integer magnitude. Exact large lengths/counts use decimal strings. Original record indexes and code-unit positions are zero-based; span ends are exclusive unless stated otherwise.
Alternative or Complementary methods
Choose word membership, prefix existence, completion or ranking according to the question. Normalize text separately if needed; these operations preserve exact code units and caller order.
References
Similar or alternative tools
- Prefix Trie Path Compressed Edge Table
Bounded explicit prefix trie with root ID 0, unique sibling UTF-16 code-unit edges and terminal flags; compress unary nonterminal chains to multi-code-unit edge labels while retaining source endpoint IDs and all terminal boundaries.
- Prefix Trie Query Missing Edge Witness
Bounded explicit prefix trie with root ID 0, unique sibling UTF-16 code-unit edges and terminal flags; report the first missing literal edge with matched prefix; a fully matched nonterminal path is structurally present, not a missing edge.