Class: Pacer::Routes::PathsRoute

Inherits:
Object
  • Object
show all
Includes:
Core::Route, BulkOperations
Defined in:
lib/pacer/route/paths_route.rb

Instance Attribute Summary

Attributes included from Core::Route

#graph, #hide_elements, #pipe_args, #pipe_class, #route_name

Instance Method Summary (collapse)

Methods included from BulkOperations

#bulk_job, #bulk_map

Methods included from Core::Route

#-, #==, #add_extension, #add_extensions, #each_context, #each_element, #each_object, #each_path, #empty?, #except, #extensions, #extensions=, #from_graph?, #inspect, #only, #route, #set_pipe_source, #vars

Constructor Details

- (PathsRoute) initialize(back)



6
7
8
# File 'lib/pacer/route/paths_route.rb', line 6

def initialize(back)
  @back = back
end

Instance Method Details

- (Boolean) root?



12
13
14
# File 'lib/pacer/route/paths_route.rb', line 12

def root?
  false
end

- (Object) subgraph(target_graph = nil)



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pacer/route/paths_route.rb', line 20

def subgraph(target_graph = nil)
  raise "Can't create a subgraph within itself." if target_graph == graph
  target_graph ||= Pacer.tg
  target_graph.vertex_name ||= graph.vertex_name
  bulk_job(nil, target_graph) do |path|
    path_route = path.to_route(:graph => graph, :element_type => :mixed)
    path_route.v.each do |vertex|
      vertex.clone_into target_graph
    end
    path_route.e.each do |edge|
      edge.clone_into target_graph
    end
  end
  target_graph
end

- (Object) transpose



16
17
18
# File 'lib/pacer/route/paths_route.rb', line 16

def transpose
  collect { |arraylist| arraylist.to_a }.transpose
end