task_graph__node_link__mst_weight¶
Program Contract¶
Program: sum(weights(minimum_spanning_tree(graph))); scene=node_link; scope=mst_weight
Candidate set: the visible graph, tree, network, route, matrix, table, node, edge, label, weight, path, and option elements inside the mst_weight objective scope.
Operands: visible scene state and prompt-bound operands named by weights, minimum_spanning_tree, graph, node_link, mst_weight.
Operation: evaluate sum over the candidate set using the visible graph structure, labels, weights, directions, reachability, paths, connectivity, or option-selection constraints encoded in the program expression; generation enforces a unique final answer.
Output binding: answer uses the integer schema; the sum of the weights on the unique minimum spanning tree,.
Annotation witnesses: annotation uses the segment_set schema; the segment_set of endpoint-node-center segments for all MST edges.
Query ids: single.
Reasoning Operations¶
Families: ranking, aggregation, topology
1) Identity¶
- Domain:
graph - Scene:
optimization - Scene id:
weighted_node_link - Task id:
task_graph__node_link__mst_weight - Objective: return the total weight of the graph's unique minimum spanning tree.
2) Scene + task contract¶
- Branch metadata:
query_id query_id:single- Supported
scene_variantvalues:circular,shell,spring,grid_jitter,layered,component_clustered,path_spine,radial_tree answer_gt.type:integerannotation_gt.type:segment_set- Scene contract:
- one single-panel labeled connected weighted graph per image,
- undirected graph only,
- no self-loops,
- no multi-edges,
- visible node labels use uppercase letters by default (
A..J), - node count is sampled from
4..7, - generation always includes at least one non-tree edge so the scene never collapses to a bare tree.
- Query contract:
- the prompt defines a spanning tree as connecting every node without cycles and asks for the smallest total edge weight,
- answer is the sum of the weights on the unique minimum spanning tree,
- annotation is the unordered set of MST edges, represented as endpoint-node-center pixel segments
[[x0, y0], [x1, y1]], with each endpoint as an[x, y]pixel point.
- annotation is the unordered set of MST edges, represented as endpoint-node-center pixel segments
- Weight policy:
- edge weights are distinct integers from
1..9, - generation samples
1..2non-tree edges, - the heaviest sampled weights are assigned to non-tree edges so the intended spanning tree is the unique MST by construction,
- the finalized weighted graph is rechecked with
networkx.minimum_spanning_tree(...)before exposing answer or annotation. - Topology variation:
topology_profilevalues arebalanced,low_degree, andhub_heavy,- topology profile affects both the spanning-tree shape and which non-tree edges are added,
- graph semantics always come from adjacency + weights, never from layout position.
- Layout variation:
scene_variantrecords the realized graph layout,- requested layout variants are all reusable node-link layouts:
circular|shell|spring|grid_jitter|layered|component_clustered|path_spine|radial_tree, - the renderer may fall back to a cleaner node-link layout when a sampled layout is too cramped for readable node or edge-label separation.
- Visual variation:
- one whole-image named node color is sampled from the shared Trace named-color palette,
- one whole-image node glyph style is sampled from
circle|rounded_square|hexagon, - one whole-image label format is sampled as
lettersby default; numeric labels remain renderer-supported but are not part of this task's default generation distribution, - one whole-image layout transform is sampled from
identity|rotate_90|rotate_180|rotate_270|mirror_left_right|mirror_up_down, - edge weights are rendered as small boxed integers near each edge,
- these style axes are non-semantic for this task and are recorded in trace metadata.
3) Prompt contract¶
- Bundle:
graph_node_link_optimization_v1 scene_key:single_graph_optimizationtask_key:minimum_spanning_tree_weight_query- Required slots:
- scene:
object_description - task:
question_text - answer output:
json_output_contract_answer_only,answer_hint,json_example_answer_only - answer+annotation mode:
json_output_contract,annotation_hint,answer_hint,json_example - Modes:
answer_only,answer_and_annotation - Answer JSON shape:
{"answer":12} - Answer+annotation JSON shape:
{"annotation":[[[180,220],[310,180]],[[310,180],[430,260]],[[430,260],[520,340]]],"answer":12} - Prompt-facing annotation uses
segment_set; each edge is one endpoint-node-center segment[[x0, y0], [x1, y1]], with each endpoint as an[x, y]pixel point.
4) Annotation + trace contract¶
- Prompt-facing annotation is the
segment_setof endpoint-node-center segments for all MST edges. - Each annotation item is an undirected segment; endpoint order is unordered semantically for reward matching, and the corresponding endpoint labels remain in
witness_symbolic. scene_ir.entitiesstores one node entity per rendered node plus one edge entity per rendered edge with:- endpoint labels,
- rendered segment,
- integer edge weight,
- weight-label bbox,
- MST-membership flag.
scene_ir.relationsstores:- graph directionality,
- full edge-weight list,
- MST edge list,
- adjacency map,
- degree map.
projected_annotationincludes:segment_setsegment_mapexecution_tracerecords:query_id(the concrete public query branch)scene_variantnode_countextra_edge_count- edge-weight range
- total MST weight
- MST edges
- weighted edge list
- topology profile
- requested and realized layout variants
5) Visual policy¶
- Background and post-image noise use the merged graph-domain visual defaults from
src/trace_tasks/resources/configs/domains/graph/base.yaml. - Current weighted graph scenes use a single rounded light panel on a light solid background.
- Node labels are rendered inside the nodes; edge weights are rendered in small boxed labels near edge midpoints.
- Layout and styling may vary for readability and diversity, but the prompt never refers to node position, node color, or node shape as the semantic source of truth.
- Weight labels stay semantic for this task, so trace metadata and rendered labels come from the same canonical edge-weight map.
6) Determinism + constraints¶
- Deterministic sampling/rendering from
instance_seed. - Answers and annotation come from the same finalized weighted graph.
- Unique-answer policy: generation enforces a unique MST by construction and rejects any graph whose final weighted edges do not preserve that unique witness.
- Reject/resample conditions:
- infeasible node-count / extra-edge-count / weight-range combination,
- failure to realize a connected weighted graph with at least one non-tree edge,
- failure to preserve the intended unique MST after weight assignment,
- unreadable layout that cannot keep nodes sufficiently separated.
- No semantic auto-relaxation: failures do not weaken the connectivity, weight, or unique-MST contract.
7) Complexity + tests¶
- Complexity definition/components:
topology_reasoning,visual_scan,ambiguity,clutter - Determinism/build tests:
tests/test_graph_optimization_minimum_spanning_tree_weight_contracts.py - Behavior/trace/prompt tests:
tests/test_graph_optimization_minimum_spanning_tree_weight_tasks.py - Prompt bundle/config tests:
tests/test_prompt_system.py,tests/test_scene_config.py