Class: Neography::Rest::NodePaths
- Inherits:
-
Object
- Object
- Neography::Rest::NodePaths
show all
- Extended by:
- Paths
- Includes:
- Helpers
- Defined in:
- lib/neography/rest/node_paths.rb
Instance Method Summary
collapse
-
#get(from, to, relationships, depth = 1, algorithm = "shortestPath") ⇒ Object
-
#get_all(from, to, relationships, depth = 1, algorithm = "allPaths") ⇒ Object
-
#initialize(connection) ⇒ NodePaths
constructor
A new instance of NodePaths.
-
#shortest_weighted(from, to, relationships, weight_attribute = "weight", depth = 1, algorithm = "dijkstra") ⇒ Object
Methods included from Paths
add_path, build_path, encode
Methods included from Helpers
#get_id, #json_content_type, #parse_direction
Constructor Details
#initialize(connection) ⇒ NodePaths
Returns a new instance of NodePaths.
10
11
12
|
# File 'lib/neography/rest/node_paths.rb', line 10
def initialize(connection)
@connection = connection
end
|
Instance Method Details
#get(from, to, relationships, depth = 1, algorithm = "shortestPath") ⇒ Object
14
15
16
17
|
# File 'lib/neography/rest/node_paths.rb', line 14
def get(from, to, relationships, depth = 1, algorithm = "shortestPath")
options = path_options(to, relationships, depth, algorithm)
@connection.post(base_path(:id => get_id(from)), options) || {}
end
|
#get_all(from, to, relationships, depth = 1, algorithm = "allPaths") ⇒ Object
19
20
21
22
|
# File 'lib/neography/rest/node_paths.rb', line 19
def get_all(from, to, relationships, depth = 1, algorithm = "allPaths")
options = path_options(to, relationships, depth, algorithm)
@connection.post(all_path(:id => get_id(from)), options) || []
end
|
#shortest_weighted(from, to, relationships, weight_attribute = "weight", depth = 1, algorithm = "dijkstra") ⇒ Object
24
25
26
27
|
# File 'lib/neography/rest/node_paths.rb', line 24
def shortest_weighted(from, to, relationships, weight_attribute = "weight", depth = 1, algorithm = "dijkstra")
options = path_options(to, relationships, depth, algorithm, { :cost_property => weight_attribute })
@connection.post(all_path(:id => get_id(from)), options) || {}
end
|