Elysia Tools Docs
ZH
语言
ZHESPTRUFRDEEN
返回主站
浏览工具

Math & Numbers

图最短路径计算器(Dijkstra 手算辅助)

Dijkstra 最短路径的手算辅助工具:输入 1–30 条边(每行:起点、终点、权重)与起点/终点,默认无向、可切换有向。逐轮记录“定居哪个节点、距离多少、每次松弛如何更新临时距离表”,平局按字典序取最小节点名,日志与教科书演算完全一致;负权重按业务拒绝,终点不可达作为合法结果报告。经典例:A-B 4、A-C 2、B-C 5、B-D 10、C-E 3、D-E 4、D-F 11、E-F 8,从 A 到 F → 最短距离 13,路径 A→C→E→F。

text· 文本结果打开工具

快速开始

用三种语言从你的代码中调用此工具。

cURL
curl -X POST 'https://api.elysiatools.com/zh/api/tools/graph-shortest-path' \
  -H 'Content-Type: application/json' \
  -d '{"edges":"A B 4\nA C 2\nB C 5\nB D 10\nC E 3\nD E 4\nD F 11\nE F 8","source":"A","target":"F","directed":false,"decimalPlaces":2}'

API 参考

以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。

请求端点

HTTP
POST https://api.elysiatools.com/zh/api/tools/graph-shortest-path

请求参数

参数名类型必填说明
edgestextarea是One edge per line: two node names (1–8 letters/digits) and a non-negative weight.
sourcetext是—
targettext是—
directedcheckbox否When checked, each edge only leads from the first node to the second; otherwise the graph is undirected.
decimalPlacesnumber否—

响应格式

MCP 集成

将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。

服务配置

将以下内容加入你的 MCP 客户端配置:

mcp.json
{
  "mcpServers": {
    "elysiatools-graph-shortest-path": {
      "name": "graph-shortest-path",
      "description": "Dijkstra 最短路径的手算辅助工具:输入 1–30 条边(每行:起点、终点、权重)与起点/终点,默认无向、可切换有向。逐轮记录“定居哪个节点、距离多少、每次松弛如何更新临时距离表”,平局按字典序取最小节点名,日志与教科书演算完全一致;负权重按业务拒绝,终点不可达作为合法结果报告。经典例:A-B 4、A-C 2、B-C 5、B-D 10、C-E 3、D-E 4、D-F 11、E-F 8,从 A 到 F → 最短距离 13,路径 A→C→E→F。",
      "baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=graph-shortest-path",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

列出可用工具

连接到 SSE 端点后,列出已开放的工具:

tools/list
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

调用此工具

通过工具 id 调用,参数由其参数表构建:

tools/call
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "graph-shortest-path",
    "arguments": {
  "edges": "A B 4\nA C 2\nB C 5\nB D 10\nC E 3\nD E 4\nD F 11\nE F 8",
  "source": "A",
  "target": "F",
  "directed": false,
  "decimalPlaces": 2
}
  }
}
可用逗号分隔的 toolId 在一个会话中串联多个工具,例如 /mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp(最多 20 个)。

有问题或反馈?请联系 [email protected]

浏览工具打开工具

© 2026 Elysia Tools. 开发者文档。

返回主站浏览工具

文本结果

JSON
{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}