I was looking back at some code I wrote a few months ago to query a neo4j database to find the shortest path between two people via the colleagues relationships that exist.
q1.png (5.78 KB, 下载次数: 7)
下载附件
2013-2-6 09:22 上传
The initial code, written using neography, looked like this:
01.neo = Neography::Rest.new
02.
03.start_node = neo.get_node(start_node_id)
04.destination_node = neo.get_node(destination_node_id)
05.
06.neo.get_paths(start_node,
07.destination_node,
08.{ "type" => "colleagues" },
09.depth = 3,
10.algorithm = "shortestPath")复制代码
The neography code eventually makes a POST request to /node/{start_id}/paths and provides a JSON payload containing the other information about the query.
|