graph-service/README.md

36 lines
887 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Graph Service — 图数据库服务
## 概述
基于 NetworkX 的内存图数据库服务,支持节点/边的增删查、邻居查询、路径搜索和图持久化。用于知识图谱的实体关系存储。
## 后端
NetworkX (纯 Python无需外部依赖)
## API
| 端点 | 方法 | 说明 |
|------|------|------|
| /api/status | GET | 服务状态和图统计 |
| /api/graph/add_node | POST | 添加节点 |
| /api/graph/add_edge | POST | 添加边 |
| /api/graph/neighbors | POST | 查询邻居 (支持深度) |
| /api/graph/path | POST | 最短路径查询 |
| /api/graph/query | POST | 通用图查询 |
| /api/graph/stats | POST | 图统计信息 |
| /api/graph/save | POST | 保存图到磁盘 |
| /api/graph/load | POST | 从磁盘加载图 |
## 部署
```bash
cd /data/ymq/graph-service
bash build.sh
sudo systemctl restart graph-service
```
## 端口
9092