Module: Pacer::Core::Graph::EdgesRoute
- Included in:
- Wrappers::EdgeWrapper
- Defined in:
- lib/pacer/core/graph/edges_route.rb
Overview
Basic methods for routes that contain only edges.
Instance Method Summary collapse
-
#both_v(*filters) {|VertexWrapper| ... } ⇒ VerticesRoute
Extends the route with both in and oud vertices from this route’s matching edges.
-
#e(*filters) {|EdgeWrapper| ... } ⇒ EdgesRoute
Extend route with the additional edge label, property and block filters.
-
#element_type ⇒ element_type(:edge)
The element type of this route for this graph implementation.
-
#in_v(*filters) {|VertexWrapper| ... } ⇒ VerticesRoute
Extends the route with in vertices from this route’s matching edges.
-
#labels ⇒ Core::Route
Return an route to all edge labels for edges emitted from this route.
-
#out_v(*filters) {|VertexWrapper| ... } ⇒ VerticesRoute
Extends the route with out vertices from this route’s matching edges.
-
#to_h ⇒ Hash
Returns a hash of in vertices with an array of associated out vertices.
Instance Method Details
#both_v(*filters) {|VertexWrapper| ... } ⇒ VerticesRoute
Extends the route with both in and oud vertices from this route’s matching edges.
38 39 40 41 42 43 |
# File 'lib/pacer/core/graph/edges_route.rb', line 38 def both_v(*filters, &block) Pacer::Route.property_filter(chain_route(:element_type => :vertex, :pipe_class => BothVerticesPipe, :route_name => 'bothV'), filters, block) end |
#e(*filters) {|EdgeWrapper| ... } ⇒ EdgesRoute
Extend route with the additional edge label, property and block filters.
50 51 52 |
# File 'lib/pacer/core/graph/edges_route.rb', line 50 def e(*filters, &block) filter(*filters, &block) end |
#element_type ⇒ element_type(:edge)
The element type of this route for this graph implementation.
which graph is in use.
80 81 82 |
# File 'lib/pacer/core/graph/edges_route.rb', line 80 def element_type :edge end |
#in_v(*filters) {|VertexWrapper| ... } ⇒ VerticesRoute
Extends the route with in vertices from this route’s matching edges.
26 27 28 29 30 31 |
# File 'lib/pacer/core/graph/edges_route.rb', line 26 def in_v(*filters, &block) Pacer::Route.property_filter(chain_route(:element_type => :vertex, :pipe_class => InVertexPipe, :route_name => 'inV'), filters, block) end |
#labels ⇒ Core::Route
Return an route to all edge labels for edges emitted from this route.
58 59 60 61 62 |
# File 'lib/pacer/core/graph/edges_route.rb', line 58 def labels chain_route(:pipe_class => com.tinkerpop.pipes.transform.LabelPipe, :route_name => 'labels', :element_type => :object) end |
#out_v(*filters) {|VertexWrapper| ... } ⇒ VerticesRoute
Extends the route with out vertices from this route’s matching edges.
14 15 16 17 18 19 |
# File 'lib/pacer/core/graph/edges_route.rb', line 14 def out_v(*filters, &block) Pacer::Route.property_filter(chain_route(:element_type => :vertex, :pipe_class => OutVertexPipe, :route_name => 'outV'), filters, block) end |
#to_h ⇒ Hash
Returns a hash of in vertices with an array of associated out vertices.
See #subgraph for a more useful method.
69 70 71 72 73 74 |
# File 'lib/pacer/core/graph/edges_route.rb', line 69 def to_h inject(Hash.new { |h,k| h[k]=[] }) do |h, edge| h[edge.out_vertex] << edge.in_vertex h end end |