kg-traverse

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

KG Traverse

知识图谱遍历(KG Traverse)

Perform pathfinder graph traversal starting from a seed entity. Expands outward through causal edges, scores paths by relevance, and prunes low-similarity branches.
执行从种子实体开始的路径查找图遍历。通过因果边向外扩展,按相关性为路径评分,并修剪低相似度分支。

When to use

使用场景

When you need to explore the knowledge graph starting from a specific entity -- finding what depends on it, what it depends on, or discovering indirect relationships. Useful for impact analysis, dependency chains, and understanding code structure.
当你需要从特定实体出发探索知识图谱时——查找依赖于它的内容、它所依赖的内容,或者发现间接关系。适用于影响分析、依赖链梳理和代码结构理解。

Steps

步骤

  1. Seed -- call
    mcp__claude-flow__agentdb_hierarchical-recall
    to look up the target entity by name
  2. Expand -- call
    mcp__claude-flow__agentdb_causal-edge
    to find all edges connected to the seed entity, then recursively expand outward to the specified depth (default: 3)
  3. Score -- for each path, compute relevance:
    cumulative_score = product(edge_weight * semantic_similarity(query, node))
    using
    mcp__claude-flow__agentdb_semantic-route
    for similarity
  4. Prune -- remove paths with cumulative score below 0.3
  5. Rank -- sort remaining paths by cumulative score descending
  6. Synthesize -- call
    mcp__claude-flow__agentdb_context-synthesize
    to combine the top paths into a coherent summary
  7. Report -- display the top 10 paths with: path (entity chain), relation types, cumulative score, and synthesized context
  1. 种子实体——调用
    mcp__claude-flow__agentdb_hierarchical-recall
    ,通过名称查找目标实体
  2. 扩展——调用
    mcp__claude-flow__agentdb_causal-edge
    ,找到与种子实体相连的所有边,然后递归向外扩展至指定深度(默认:3)
  3. 评分——对每条路径计算相关性:
    cumulative_score = product(edge_weight * semantic_similarity(query, node))
    ,使用
    mcp__claude-flow__agentdb_semantic-route
    计算相似度
  4. 修剪——移除累积评分低于0.3的路径
  5. 排序——将剩余路径按累积评分降序排列
  6. 合成——调用
    mcp__claude-flow__agentdb_context-synthesize
    ,将排名靠前的路径整合成连贯的摘要
  7. 报告——展示排名前10的路径,包含:路径(实体链)、关系类型、累积评分和合成上下文

CLI alternative

CLI替代方案

bash
npx @claude-flow/cli@latest memory search --query "relations for ENTITY_NAME" --namespace knowledge-graph
bash
npx @claude-flow/cli@latest memory search --query "relations for ENTITY_NAME" --namespace knowledge-graph