Skip to content

Commit

Permalink
adding Node Paths
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed Dec 11, 2010
1 parent 56fdc6e commit 0dd7b47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,17 @@ The Neo4j ID is available by using node.neo_id .
n1.rels(:friends).incoming # Get incoming friends relationships
n1.rels(:friends,:work) # Get friends and work relationships
n1.rels(:friends,:work).outgoing # Get outgoing friends and work relationships

n1.all_paths_to(n2).incoming(:friends).depth(4) # Gets all paths of a specified type
n1.all_simple_paths_to(n2).incoming(:friends).depth(4) # for the relationships defined
n1.all_shortest_paths_to(n2).incoming(:friends).depth(4) # at a maximum depth
n1.path_to(n2).incoming(:friends).depth(4) # Same as above, but just one path.
n1.simple_path_to(n2).incoming(:friends).depth(4)
n1.shortest_path_to(n2).incoming(:friends).depth(4)

n1.shortest_path_to(n2).incoming(:friends).depth(4).rels # Gets just relationships in path
n1.shortest_path_to(n2).incoming(:friends).depth(4).nodes # Gets just nodes in path


See Neo4j API for:
* {Order}[http://components.neo4j.org/neo4j-examples/1.2.M04/apidocs/org/neo4j/graphdb/Traverser.Order.html]
Expand Down
1 change: 1 addition & 0 deletions lib/neography/path_traverser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class PathTraverser
def initialize(from, to, algorithm, all=false, types = nil, dir = "all" )
@from = from
@to = to
@algorithm = algorithm
@all = all
@relationships = Array.new
types.each do |type|
Expand Down

0 comments on commit 0dd7b47

Please sign in to comment.