求rest api 调用dijkstra的例子
发布于 7 年前 作者 neo4j-twj 2209 次浏览 来自 问答

哪位大神有带权值的dijkstra例子呀?官网的文档没有具体的代码例子,下面是官方文档,谁能给我一个具体的例子,谢谢! Example request

•POST http://localhost:7474/db/data/node/99/path •Accept: application/json; charset=UTF-8 •Content-Type: application/json javascript{ “to” : “http://localhost:7474/db/data/node/103”, “cost_property” : “cost”, “relationships” : { “type” : “to”, “direction” : “out” }, “algorithm” : “dijkstra” }

Example response

•200: OK •Content-Type: application/json; charset=UTF-8 javascript{ “relationships” : [ “http://localhost:7474/db/data/relationship/70”, “http://localhost:7474/db/data/relationship/72”, “http://localhost:7474/db/data/relationship/73” ], “nodes” : [ “http://localhost:7474/db/data/node/99”, “http://localhost:7474/db/data/node/101”, “http://localhost:7474/db/data/node/102”, “http://localhost:7474/db/data/node/103” ], “directions” : [ “->”, “->”, “->” ], “start” : “http://localhost:7474/db/data/node/99”, “length” : 3, “weight” : 1.5, “end” : “http://localhost:7474/db/data/node/103” }

1 回复

直接用json api 传 cypher 指令 ,指令里 调用 allshortestpath()方法,就是 了, allshortestpath()方法内部是 地杰斯特拉 实现

回到顶部