Module: Neography::Rest::NodePaths

Includes:
Helpers
Included in:
Neography::Rest
Defined in:
lib/neography/rest/node_paths.rb

Instance Method Summary collapse

Methods included from Helpers

#encode, #escape, #get_id, #json_content_type, #parse_depth, #parse_direction, #parse_order, #parse_type, #parse_uniqueness

Instance Method Details

#get_path(from, to, relationships, depth = 1, algorithm = "shortestPath") ⇒ Object



6
7
8
9
# File 'lib/neography/rest/node_paths.rb', line 6

def get_path(from, to, relationships, depth = 1, algorithm = "shortestPath")
  options = path_options(to, relationships, depth, algorithm)
  @connection.post("/node/%{id}/path" % {:id => get_id(from)}, options) || {}
end

#get_paths(from, to, relationships, depth = 1, algorithm = "allPaths") ⇒ Object



11
12
13
14
# File 'lib/neography/rest/node_paths.rb', line 11

def get_paths(from, to, relationships, depth = 1, algorithm = "allPaths")
  options = path_options(to, relationships, depth, algorithm)
  @connection.post("/node/%{id}/paths" % {:id => get_id(from)}, options) || []
end

#get_shortest_weighted_path(from, to, relationships, weight_attribute = "weight", depth = 1, algorithm = "dijkstra") ⇒ Object



16
17
18
19
# File 'lib/neography/rest/node_paths.rb', line 16

def get_shortest_weighted_path(from, to, relationships, weight_attribute = "weight", depth = 1, algorithm = "dijkstra")
  options = path_options(to, relationships, depth, algorithm, { :cost_property => weight_attribute })
  @connection.post("/node/%{id}/paths" % {:id => get_id(from)}, options) || {}
end