visualize
它能做什么
这项技能为 Semantica 知识图谱创建可视化摘要,例如图表以及连接最多的条目表格。适合想看清数据结构的人。
适用场景
- ✓当你想了解图谱中条目和连接如何组织的概况的时候。
- ✓当你想找出图谱中最核心或最有影响力的条目的时候。
- ✓当你想绘制两个条目之间路径的图示的时候。
技能链接
https://github.com/semantica-agi/semantica/blob/main/plugins/skills/visualize/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把知识图谱中连接最多的条目以表格形式展示给我,并画出 Acme 和 Globex 之间的路径?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会分析图谱结构,衡量每个条目的中心程度,并把条目归为不同的社群。结果会以 Mermaid 图、ASCII 视图或结构化表格的形式呈现。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
/semantica:visualize
Render graph visualizations as Mermaid, ASCII, or structured Markdown. Usage: /semantica:visualize <sub-command> [args]
$ARGUMENTS = sub-command + optional node label or filter.
topology [--filter <node_type>]
Full graph structure analysis — node types, edge distribution, connectivity metrics.
from semantica.kg.graph_analyzer import GraphAnalyzer
from semantica.context import ContextGraph
graph = ContextGraph(advanced_analytics=True)
analyzer = GraphAnalyzer()
# Comprehensive analysis
analysis = analyzer.analyze_graph(graph=graph.to_dict())
metrics = analyzer.compute_metrics(graph=graph)
connectivity = analyzer.analyze_connectivity(graph=graph)
Output:
Graph Topology:
Nodes: N (M types)
Edges: P
Density: 0.23
Avg degree: 4.7
Connected: YES / NO (K components)
Node type distribution:
[Mermaid pie chart]
| Type | Count | % | Avg Degree |
Top-10 connected nodes:
| Node | Type | Degree | Betweenness |
centrality [--type degree|betweenness|closeness|eigenvector|pagerank|all] [--top N]
Calculate and rank nodes by centrality.
from semantica.kg.centrality_calculator import CentralityCalculator
from semantica.context import ContextGraph
graph = ContextGraph()
calc = CentralityCalculator()
if centrality_type == "all" or not centrality_type:
scores = calc.calculate_all_centrality(graph=graph)
elif centrality_type == "degree":
scores = calc.calculate_degree_centrality(graph=graph)
elif centrality_type == "betweenness":
scores = calc.calculate_betweenness_centrality(graph=graph)
elif centrality_type == "closeness":
scores = calc.calculate_closeness_centrality(graph=graph)
elif centrality_type == "eigenvector":
scores = calc.calculate_eigenvector_centrality(graph=graph)
elif centrality_type == "pagerank":
scores = calc.calculate_pagerank(
graph=graph,
max_iterations=100,
damping_factor=0.85,
)
Return: | Rank | Node | Type | Degree | Betweenness | Closeness | Eigenvector | PageRank |
For a single node, also call ContextGraph.get_node_centrality(node_id) and get_node_importance(node_id).
community [--algorithm louvain|leiden|label-propagation|overlapping]
Detect and visualize graph communities/clusters.
from semantica.kg.community_detector import CommunityDetector
from semantica.context import ContextGraph
graph = ContextGraph()
detector = CommunityDetector()
algorithm = algo_arg or "louvain"
if algorithm == "louvain":
result = detector.detect_communities_louvain(graph, resolution=1.0)
elif algorithm == "leiden":
result = detector.detect_communities_leiden(graph, resolution=1.0)
elif algorithm == "label-propagation":
result = detector.detect_communities_label_propagation(graph)
elif algorithm == "overlapping":
result = detector.detect_overlapping_communities(graph)
else:
result = detector.detect_communities(graph, algorithm=algorithm)
structure = detector.analyze_community_structure(graph, result)
metrics = detector.calculate_community_metrics(graph, result)
Output:
Community Detection (algorithm: louvain)
Communities: N
Modularity: 0.71
Community summary:
| ID | Size | Top Node | Internal Density | Bridge Nodes |
[Mermaid graph TD — nodes colored/grouped by community ID]
path <n1> <n2> [--k N] [--algorithm bfs|dijkstra|astar|k-shortest]
Find and visualize paths between two nodes.
from semantica.kg.path_finder import PathFinder
from semantica.context import ContextGraph
graph = ContextGraph()
finder = PathFinder()
k = int(k_arg) if k_arg else 3
if algorithm == "bfs":
path = finder.bfs_shortest_path(graph, source=n1, target=n2)
paths = [path]
elif algorithm == "dijkstra":
path = finder.dijkstra_shortest_path(graph, source=n1, target=n2)
paths = [path]
else: # default: k-shortest
paths = finder.find_k_shortest_paths(graph, source=n1, target=n2, k=k)
lengths = [finder.path_length(graph, p) for p in paths]
Output as Mermaid sequenceDiagram for each path:
Path 1 (length: 2.3):
n1 →[rel_type]→ Middle →[rel_type]→ n2
Path 2 (length: 3.7): ...
decision-graph [--category <cat>] [--depth N]
Visualize the decision influence graph for a category or all decisions.
from semantica.context import ContextGraph
from semantica.context.causal_analyzer import CausalChainAnalyzer
from semantica.conte
常见问题
什么是中心性?
它衡量一个条目在链接网络中的重要程度或连接程度。
图中的社群是什么?
社群是彼此之间联系比与图中其他部分联系更紧密的一组条目。
图表可以使用哪些格式?
Mermaid、ASCII 和结构化的 Markdown 表格。
详情
作者的原始描述
Visualize the Semantica knowledge graph — topology, centrality, communities, paths, embeddings, decision insights, and temporal evolution. Uses GraphAnalyzer, CentralityCalculator, CommunityDetector, PathFinder, and ContextGraph analytics. Sub-commands: topology, centrality, community, path, decision-graph, insights, temporal, embedding.
repo: semantica-agi/semantica
热度
- GitHub 星标
- 14k
- 排名
- #11158
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …