task_graph__node_link__longest_path_length¶
Program Contract¶
Program: length(longest_path(directed_acyclic_graph)); scene=node_link; scope=longest_path_length
Candidate set: the visible graph, tree, network, route, matrix, table, node, edge, label, weight, path, and option elements inside the longest_path_length objective scope.
Operands: visible scene state and prompt-bound operands named by longest_path, directed_acyclic_graph, node_link, longest_path_length.
Operation: evaluate length 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 number of directed edges in that unique longest path.
Annotation witnesses: annotation uses the point_sequence schema; the ordered point_sequence of node-center pixel points along the unique longest directed path.
Query ids: single.
Reasoning Operations¶
Families: counting, ranking, topology
1) Identity¶
- Domain:
graph - Scene:
path - Scene id:
node_link - Task id:
task_graph__node_link__longest_path_length - Objective: count the number of directed edges in the unique longest path of a directed acyclic graph.
2) Scene + task contract¶
- Branch metadata:
query_id query_id:single- Supported
graph_directionality:directed answer_gt.type:integerannotation_gt.type:point_sequence- Scene contract:
- one single-panel labeled directed node-link graph,
- graph is a DAG,
- simple unweighted graph only,
- no self-loops, multi-edges, or reciprocal directed edge pairs,
- visible node labels use one whole-image label format (
letters,numbers, ornamed), - node count is sampled from
5..10. - Query contract:
- the prompt states that the directed graph has a unique longest directed path,
- answer support is
2..6, - answer is the number of directed edges in that unique longest path.
3) Prompt contract¶
- Bundle:
graph_node_link_path_v1 scene_key:single_graph_pathtask_key:longest_path_length_query- Modes:
answer_only,answer_and_annotation - Answer JSON shape:
{"answer":2} - Answer+annotation JSON shape:
{"annotation":[[180,220],[310,180],[430,260]],"answer":2} - Prompt-facing annotation uses an ordered pixel-space node-center sequence from the start of the longest path to its end.
4) Annotation + trace contract¶
- Prompt-facing annotation is the ordered
point_sequenceof node-center pixel points along the unique longest directed path. answer_gt.value == len(annotation_gt.value) - 1by construction.execution_trace.longest_path_labelsrecords the symbolic path in order.execution_trace.source_labelandexecution_trace.goal_labelrecord the first and last nodes of the longest path.scene_ir.entitiesstores node labels, in-degrees, out-degrees, successors, predecessors, center points, node bboxes, andis_on_longest_path.projected_annotationincludespoint_sequence,pixel_point_sequence, andpixel_bbox_set.
5) Visual policy¶
- Rendering uses the shared graph light-panel style from
src/trace_tasks/resources/configs/domains/graph/base.yaml. - Directed edges render arrowheads.
- Node label format, edge routing, glyph style, named node color, layout transform, and layout are visual variation only.
- The prompt never refers to node position, color, or shape as semantic annotation.
6) Determinism + constraints¶
- Deterministic sampling/rendering from
instance_seed. - Answers and annotation come from the same finalized successor adjacency map.
- Generation starts from a directed backbone path of the requested length and only keeps side branches or extra edges when a longest-path DP check confirms that the global longest path is unique and unchanged.
- No semantic auto-relaxation: failures do not weaken the DAG, label, or unique-longest-path contract.
7) Complexity + tests¶
- Complexity components:
topology_reasoning,visual_scan,ambiguity,clutter - Tests:
tests/test_graph_path_longest_path_length_contracts.py,tests/test_graph_path_longest_path_length_tasks.py,tests/test_prompt_system.py,tests/test_scene_config.py