Description
Grow a bounded scored tree and delegate beam traces, comparing the result with exhaustive best paths at the same depth to expose pruning losses.
A graph uses vertices and edges to represent relationships. Direction, duplicate handling, indexing, and traversal order affect its interpretation; returning a constructed graph together with a witness or calculated answer helps verify an algorithm.
Grow a bounded scored tree and delegate beam traces, comparing the result with exhaustive best paths at the same depth to expose pruning losses.
When to use this tool
Use this generator to create reproducible beam search pruning challenge cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.
How to use the tool and how it works
- Supply branchingFactor, treeDepth, searchDepth, width, minimumScore, maximumScore in the field shapes below. Set seed when you need an explicit replay.
- Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
- Read nodes, beam, comparison, convention. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.
Draw a complete scored tree and run beam search to searchDepth. Exhaustively enumerate all paths to that same depth, compare cumulative scores, and return the optimality gap and whether the beam score matches the exhaustive best.1
Delegated operations used for this result: beam search. Their calculation or parsing conventions apply to the corresponding result fields.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| branchingFactor | Branching Factor | Required. Safe integer; minimum 2; maximum 4. |
| treeDepth | Tree Depth | Required. Safe integer; minimum 1; maximum 5. |
| searchDepth | Search Depth | Required. Safe integer; minimum 1; maximum 5. |
| width | Width | Required. Safe integer; minimum 1; maximum 16. |
| minimumScore | Minimum Score | Required. Safe integer. |
| maximumScore | Maximum Score | Required. Safe integer. |
| seed | Optional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed. | Optional. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| nodes | Nodes | Required. Array of Object; no unknown keys.; minimum items 3; maximum items 341. |
| nodes[].label | Supplied display label. | Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 64. |
| nodes[].parent | Parent | Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 64. or Null. |
| nodes[].depth | Depth | Required. Safe integer; minimum 0; maximum 5. |
| nodes[].score | Score | Required. Safe integer. |
| beam | Beam | Required. Object; no unknown keys. |
| beam.bestPath | Best Path | Required. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 64.; minimum items 1; maximum items 6. |
| beam.bestScore | Best Score | Required. Finite number. |
| beam.levels | Levels | Required. Array of Object; no unknown keys.; minimum items 1; maximum items 5. |
| beam.levels[].kept | Kept | Required. Array of Text.; minimum items 1; maximum items 16. |
| beam.levels[].pruned | Pruned | Required. Array of Text.; minimum items 0; maximum items 64. |
| comparison | Comparison | Required. Object; no unknown keys. |
| comparison.depth | Depth | Required. Safe integer; minimum 1; maximum 5. |
| comparison.exhaustivePathCount | Exhaustive Path Count | Required. Safe integer; minimum 2; maximum 256. |
| comparison.exhaustiveBestPath | Exhaustive Best Path | Required. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 64.; minimum items 1; maximum items 6. |
| comparison.exhaustiveBestScore | Exhaustive Best Score | Required. Finite number. |
| comparison.gap | Gap | Required. Finite number. |
| comparison.beamIsOptimal | Beam Is Optimal | Required. Boolean. |
| convention | Convention | Required. Text. |
| randomness | Replay source and normalized 32-bit seed, or null seed for an advancing context source. | Required. Object; no unknown keys. |
| randomness.seed | Optional safe-integer replay seed; normalization and precedence are explained below. | Required. Safe integer. or Null. |
| randomness.source | Source | Required. Text; one of "context", "seed". |
An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.
{
"input": {
"branchingFactor": 2,
"treeDepth": 2,
"searchDepth": 2,
"width": 1,
"minimumScore": -5,
"maximumScore": 5,
"seed": 42
},
"output": {
"nodes": [
{
"label": "n000",
"parent": null,
"depth": 0,
"score": 0
},
{
"label": "n001",
"parent": "n000",
"depth": 1,
"score": 1
},
{
"label": "n002",
"parent": "n001",
"depth": 2,
"score": -1
},
{
"label": "n003",
"parent": "n001",
"depth": 2,
"score": 4
},
{
"label": "n004",
"parent": "n000",
"depth": 1,
"score": 2
},
{
"label": "n005",
"parent": "n004",
"depth": 2,
"score": -4
},
{
"label": "n006",
"parent": "n004",
"depth": 2,
"score": 0
}
],
"beam": {
"bestPath": [
"n000",
"n004",
"n006"
],
"bestScore": 2,
"levels": [
{
"kept": [
"n000 > n004"
],
"pruned": [
"n000 > n001"
]
},
{
"kept": [
"n000 > n004 > n006"
],
"pruned": [
"n000 > n004 > n005"
]
}
]
},
"comparison": {
"depth": 2,
"exhaustivePathCount": 4,
"exhaustiveBestPath": [
"n000",
"n001",
"n003"
],
"exhaustiveBestScore": 5,
"gap": 3,
"beamIsOptimal": false
},
"convention": "Scores are cumulative node increments from a zero-score root. Compare paths at the same depth; ties use the core's ascending path-label convention. Beam pruning may discard the exhaustive optimum.",
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- The root contributes zero and other scores are node increments. Narrow beams can discard the optimum. Equal-score paths follow the stated label convention; the tree and arithmetic budgets bound exhaustive comparison.
- A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
- The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.
Alternative or Complementary methods
For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.
References
Similar or alternative tools
- Strongly Connected Components Finder
Partition a bounded directed graph into canonical strongly connected components and return vertex memberships plus its deduplicated condensation edges using iterative Kosaraju–Sharir searches.
- Random Clique Instance Generator
Generate a simple graph with a planted clique and independent Bernoulli background edges; the witness is not claimed to be maximum.