Class: Pacer::Neo4j2::Algo::TraversalBranchWrapper

Inherits:
PathWrapper
  • Object
show all
Defined in:
lib/pacer-neo4j2/algo/traversal_branch_wrapper.rb

Overview

Uses the interface defined here: api.neo4j.org/1.8/org/neo4j/graphdb/traversal/TraversalBranch.html

Note that I have removed methods that I didn’t understand, assuming they are internal.

Instance Attribute Summary

Attributes inherited from PathWrapper

#graph, #raw_path

Instance Method Summary collapse

Methods inherited from PathWrapper

#both, #both_e, #both_edges, #both_vertices, #e, #end_e, #end_v, #in, #in_e, #in_edges, #in_vertices, #initialize, #length, #out, #out_e, #out_edges, #out_vertices, #path, #reverse_e, #reverse_v, #start_v, #to_a, #v

Constructor Details

This class inherits a constructor from Pacer::Neo4j2::Algo::PathWrapper

Instance Method Details

#continues?Boolean

Returns whether or not the traversal should continue further along this branch.

Returns:

  • (Boolean)


10
11
12
# File 'lib/pacer-neo4j2/algo/traversal_branch_wrapper.rb', line 10

def continues?
  raw_path.continues
end

#included?Boolean

Returns whether or not this branch (the Path representation of this branch at least) should be included in the result of this traversal, i.e. returned as one of the Paths from f.ex. TraversalDescription.traverse(org.neo4j.graphdb.Node…)

Returns:

  • (Boolean)


23
24
25
# File 'lib/pacer-neo4j2/algo/traversal_branch_wrapper.rb', line 23

def included?
  raw_path.includes
end

#inspectObject



41
42
43
# File 'lib/pacer-neo4j2/algo/traversal_branch_wrapper.rb', line 41

def inspect
  "#<TBR #{to_s}>"
end

#num_expandedObject

Returns the number of edges this expansion source has expanded.



15
16
17
# File 'lib/pacer-neo4j2/algo/traversal_branch_wrapper.rb', line 15

def num_expanded
  raw_path.expanded
end

#parentObject

The parent expansion source which created this TraversalBranch.



28
29
30
# File 'lib/pacer-neo4j2/algo/traversal_branch_wrapper.rb', line 28

def parent
  TraversalBranchWrapper.new raw_path.parent, graph
end

#prune!Object

Explicitly tell this branch to be pruned so that consecutive calls to #next() is guaranteed to return null.



33
34
35
# File 'lib/pacer-neo4j2/algo/traversal_branch_wrapper.rb', line 33

def prune!
  raw_path.prune
end

#to_sObject



37
38
39
# File 'lib/pacer-neo4j2/algo/traversal_branch_wrapper.rb', line 37

def to_s
  "#{super} num_expanded: #{ num_expanded }#{ continues? ? ' continues' : '' }#{ included? ? ' included' : '' }"
end