Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (41 sloc) 1.32 kB
module Pacer::Core::Graph
module PathRoute
def transpose
collect { |arraylist| arraylist.to_a }.transpose
end
def subgraph(target_graph = nil, opts = {})
raise "Can't create a subgraph within itself." if target_graph == graph
target_graph ||= Pacer.tg
target_graph.vertex_name ||= graph.vertex_name
missing_edges = Set[]
bulk_job(nil, target_graph) do |path|
path.select { |e| e.is_a? Pacer::Vertex }.each do |vertex|
vertex.clone_into target_graph
end
path.select { |e| e.is_a? Pacer::Edge }.each do |edge|
unless edge.clone_into target_graph, ignore_missing_vertices: true
missing_edges << edge
end
end
end
if missing_edges.any?
missing_edges.to_route(graph: graph, element_type: :edge).bulk_job nil, target_graph do |edge|
edge.clone_into target_graph,
ignore_missing_vertices: opts[:ignore_missing_vertices],
show_missing_vertices: opts[:show_missing_vertices]
end
end
target_graph
end
protected
def configure_iterator(iter)
if respond_to? :graph
pipe = Pacer::Pipes::PathWrappingPipe.new(graph)
pipe.setStarts iter
pipe
else
iter
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.