> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memorose.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 知识图谱

> 连接记忆单元、任务和洞察的图谱关系。

# 知识图谱（Knowledge Graph）

Memorose 使用图谱关系来连接记忆单元（Memory Unit）、任务和更高层级的洞察。

## 图谱增长的两种方式

### 自动关联

后台处理可以通过相似度分析、记忆整合（Consolidation）和社区分析来创建图谱结构。

### 手动关联

你可以通过 API 显式添加边：

```bash theme={null}
curl -s -X POST "http://127.0.0.1:3000/v1/users/user_123/graph/edges" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source_id": "11111111-1111-1111-1111-111111111111",
    "target_id": "22222222-2222-2222-2222-222222222222",
    "relation": "RelatedTo",
    "weight": 0.75
  }'
```

支持的关系值来自核心关系模型，包括：

* `Next`
* `RelatedTo`
* `Contradicts`
* `Supports`
* `Abstracts`
* `DerivedFrom`
* `CausedBy`
* `EvolvedTo`
* `IsSubTaskOf`
* `Blocks`
* `Accomplishes`

## 检索集成

检索接受 `graph_depth` 参数，因此图谱结构可以影响最终结果集，而非作为一个孤立的子系统存在。
