> ## 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.

# 图 API

> 在记忆对象之间创建图边。

# 图 API（Graph API）

## POST `/v1/users/:user_id/graph/edges`

在两个记忆对象之间创建图边（Graph Edge）。

## 请求

```http theme={null}
POST /v1/users/user_123/graph/edges
Authorization: Bearer <token>
Content-Type: application/json

{
  "source_id": "11111111-1111-1111-1111-111111111111",
  "target_id": "22222222-2222-2222-2222-222222222222",
  "relation": "RelatedTo",
  "weight": 0.8
}
```

## 字段

| Field       | Type   | Required | 描述        |
| ----------- | ------ | -------- | --------- |
| `source_id` | UUID   | Yes      | 源记忆或任务节点  |
| `target_id` | UUID   | Yes      | 目标记忆或任务节点 |
| `relation`  | string | Yes      | 关系类型      |
| `weight`    | number | No       | 可选的边权重    |

## 响应

```json theme={null}
{
  "status": "accepted"
}
```

## 支持的关系类型

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