MCPcopy Create free account
hub / github.com/Qinbf/groundmap / fmt_graph

Function fmt_graph

scripts/k.py:2652–2668  ·  view source on GitHub ↗
(data: dict)

Source from the content-addressed store, hash-verified

2650
2651
2652def fmt_graph(data: dict):
2653 nodes = data.get("nodes", [])
2654 edges = data.get("edges", [])
2655 print(f"📊 wiki 链接图谱:{len(nodes)} 节点 · {len(edges)} 边\n")
2656 by_type: dict[str, int] = {}
2657 for n in nodes:
2658 by_type[n["type"]] = by_type.get(n["type"], 0) + 1
2659 print(" 节点分布:")
2660 for t, c in sorted(by_type.items(), key=lambda x: -x[1]):
2661 print(f" {t:20s} {c}")
2662 by_rel: dict[str, int] = {}
2663 for e in edges:
2664 by_rel[e["link_type"]] = by_rel.get(e["link_type"], 0) + 1
2665 print("\n 边分布:")
2666 for r, c in sorted(by_rel.items(), key=lambda x: -x[1]):
2667 print(f" {r:20s} {c}")
2668 print("\n (JSON 详情请加 --json)")
2669
2670
2671def fmt_bare_claims(items: list[dict]):

Callers 1

_main_implFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected