[[rest-api-execute-a-dijkstra-algorithm-with-similar-weights-on-relationships]]
=== Execute a Dijkstra algorithm with similar weights on relationships ===

.Final Graph
["dot", "Final-Graph-Execute-a-Dijkstra-algorithm-with-similar-weights-on-relationships.svg", "neoviz"]
----
  N270 [
    label = "{Node\[270\]|name = \'f\'\l}"
  ]
  N271 [
    label = "{Node\[271\]|name = \'d\'\l}"
  ]
  N271 -> N278 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N271 -> N272 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N272 [
    label = "{Node\[272\]|name = \'e\'\l}"
  ]
  N272 -> N278 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N272 -> N270 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N273 [
    label = "{Node\[273\]|name = \'b\'\l}"
  ]
  N273 -> N278 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N273 -> N274 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N274 [
    label = "{Node\[274\]|name = \'c\'\l}"
  ]
  N274 -> N278 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N274 -> N278 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N274 -> N271 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N275 [
    label = "{Node\[275\]|name = \'start\'\l}"
  ]
  N275 -> N276 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N276 [
    label = "{Node\[276\]|name = \'a\'\l}"
  ]
  N276 -> N278 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N276 -> N273 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N277 [
    label = "{Node\[277\]|name = \'y\'\l}"
  ]
  N278 [
    label = "{Node\[278\]|name = \'x\'\l}"
  ]
  N278 -> N277 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
----

_Example request_

* *+POST+*  +http://localhost:7474/db/data/node/275/path+
* *+Accept:+* +application/json+
* *+Content-Type:+* +application/json+
[source,javascript]
----
{
  "to" : "http://localhost:7474/db/data/node/278",
  "cost_property" : "cost",
  "relationships" : {
    "type" : "to",
    "direction" : "out"
  },
  "algorithm" : "dijkstra"
}
----


_Example response_

* *+200:+* +OK+
* *+Content-Type:+* +application/json+
[source,javascript]
----
{
  "weight" : 2.0,
  "start" : "http://localhost:7474/db/data/node/275",
  "nodes" : [ "http://localhost:7474/db/data/node/275", "http://localhost:7474/db/data/node/276", "http://localhost:7474/db/data/node/278" ],
  "length" : 2,
  "relationships" : [ "http://localhost:7474/db/data/relationship/159", "http://localhost:7474/db/data/relationship/160" ],
  "end" : "http://localhost:7474/db/data/node/278"
}
----


