[[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"]
----
  N33 [
    label = "{Node\[33\]|name = \'f\'\l}"
  ]
  N34 [
    label = "{Node\[34\]|name = \'d\'\l}"
  ]
  N34 -> N41 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N34 -> N35 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N35 [
    label = "{Node\[35\]|name = \'e\'\l}"
  ]
  N35 -> N41 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N35 -> N33 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N36 [
    label = "{Node\[36\]|name = \'b\'\l}"
  ]
  N36 -> N41 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N36 -> N37 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N37 [
    label = "{Node\[37\]|name = \'c\'\l}"
  ]
  N37 -> N41 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N37 -> N41 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N37 -> N34 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N38 [
    label = "{Node\[38\]|name = \'start\'\l}"
  ]
  N38 -> N39 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N39 [
    label = "{Node\[39\]|name = \'a\'\l}"
  ]
  N39 -> N41 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N39 -> N36 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
  N40 [
    label = "{Node\[40\]|name = \'y\'\l}"
  ]
  N41 [
    label = "{Node\[41\]|name = \'x\'\l}"
  ]
  N41 -> N40 [
    color = "#2e3436"
    fontcolor = "#2e3436"
    label = "to\ncost = 1\l"
  ]
----

_Example request_

* *+POST+*  +http://localhost:7474/db/data/node/38/path+
* *+Accept:+* +application/json+
* *+Content-Type:+* +application/json+
[source,javascript]
----
{
  "to" : "http://localhost:7474/db/data/node/41",
  "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/38",
  "nodes" : [ "http://localhost:7474/db/data/node/38", "http://localhost:7474/db/data/node/39", "http://localhost:7474/db/data/node/41" ],
  "length" : 2,
  "relationships" : [ "http://localhost:7474/db/data/relationship/33", "http://localhost:7474/db/data/relationship/34" ],
  "end" : "http://localhost:7474/db/data/node/41"
}
----


