File size: 4,239 Bytes
75eecbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/topology-qa/topoqa/instance-1.3.json",
  "title": "topoqa instance (v1.3)",
  "description": "一条实例 = 一张图(只存 key)+ 一个任务 + 一次具体问法。图的元数据在 00-graph/manifest.csv。",
  "type": "object",
  "required": ["schema", "id", "task", "split", "graph", "question", "anchor", "answer", "gold"],
  "additionalProperties": false,
  "properties": {
    "schema": {"const": "topoqa/1.3"},
    "id": {
      "type": "string",
      "pattern": "^(base|mid|large)\\.[a-z_]+\\.[A-Za-z0-9_#.-]+\\.q[0-9]{2}$",
      "description": "{tier}.{task}.{graph}.q{ii};不含 split,改切分不改 ID。"
    },
    "task": {
      "enum": [
        "node_degree", "edge_existence", "path_length",
        "partition_modularity", "triangle_count", "dismantle_order"
      ],
      "description": "封闭枚举,代码依赖它;自由分析的标签放 qtype,不放这里。"
    },
    "split": {
      "enum": ["dev", "test", "holdout", "ood", "transfer"],
      "description": "与 00-graph/manifest.csv 的 split 列必须一致(tests 会查)。"
    },
    "graph": {
      "type": "string",
      "description": "00-graph/manifest.csv 的 key。图的 n/m/family/domain/path 都从那里 join。"
    },
    "question": {"type": "string", "minLength": 8},
    "anchor": {
      "type": "object",
      "required": ["type", "nodes"],
      "additionalProperties": false,
      "properties": {
        "type": {"enum": ["node", "node_pair", "node_set", "graph"]},
        "nodes": {"type": "array", "items": {"type": "integer"}}
      },
      "description": "解题入口。mid 的 node_set / graph 用它承载多锚点与图级任务。"
    },
    "answer": {
      "type": "object",
      "required": ["type", "value"],
      "additionalProperties": false,
      "properties": {
        "type": {
          "enum": ["bool", "int", "float", "choice", "set", "partition", "edge_set", "sequence"]
        },
        "value": {},
        "match": {
          "enum": ["exact", "set_f1", "nmi", "choice", "numeric_tol", "curve"],
          "description": "可选。缺省按 task 约定(见 README §6)。"
        }
      }
    },
    "gold": {
      "type": "object",
      "required": ["kind"],
      "description": "见证:够用就好,能重算的不存(邻居表/长路径)。",
      "properties": {
        "kind": {
          "enum": [
            "neighbors", "edge", "non_edge", "shortest_path",
            "modularity", "triangle", "dismantle"
          ]
        },
        "of": {"type": "integer", "description": "neighbors / triangle(node):哪个点"},
        "u": {"type": "integer"},
        "v": {"type": "integer"},
        "via": {"type": "integer", "description": "non_edge:距离 2 的中间点"},
        "src": {"type": "integer"},
        "dst": {"type": "integer"},
        "len": {"type": "integer"},
        "path": {"type": "array", "items": {"type": "integer"}, "description": "≤64 点时给全路径"},
        "truncated": {"type": "boolean"},
        "head": {"type": "array", "items": {"type": "integer"}},
        "tail": {"type": "array", "items": {"type": "integer"}},
        "scope": {"enum": ["graph", "node"], "description": "triangle:全图还是某个点"},
        "count": {"type": "integer", "description": "triangle:三角形个数"},
        "specs": {
          "type": "object",
          "additionalProperties": {"type": "string"},
          "description": "modularity:A/B/C 各自的划分说明串(与题面文字同源,可重算)"
        },
        "q": {
          "type": "object",
          "additionalProperties": {"type": "number"},
          "description": "modularity:每个候选的 Q(6 位小数)"
        },
        "ask": {"enum": ["max", "min"], "description": "modularity:问最大还是最小"},
        "order": {
          "type": "array", "items": {"type": "integer"},
          "description": "dismantle:删除的节点序列(审计用见证)。判分只看 answer 里的度数序列——换 tie-break 会改 order,但 97% 的实例不改度数序列。"
        }
      }
    }
  }
}