collect采用gpt生成,适用于mosaic结果的分析

collect采用gpt生成,适用于mosaic结果的分析

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

# 从管道读取 JSON 格式输入
input=$(cat)

# 检查 JSON 数据中是否包含 "vertices" 和 "edges"
if ! echo "$input" | jq -e '.vertices and .edges' > /dev/null; then
echo "Error: JSON input must contain 'vertices' and 'edges' arrays."
exit 1
fi

# 提取路径中的节点信息
path=$(echo "$input" | jq -r '.vertices[-1].stdout')
# 计算顶点 |V| 和边 |E| 数量
num_vertices=$(echo "$input" | jq '.vertices | length')
num_edges=$(echo "$input" | jq '.edges | length')

# 生成唯一的输出计数
unique_outputs=1

# 输出格式
echo "$path"
echo "|V| = $num_vertices, |E| = $num_edges."
echo "There are $unique_outputs distinct outputs."