Sha256: 4b121b6d120fbb297936fa5549baeab6ca99d26d8d75277c44fec54e8bf580e9
Contents?: true
Size: 1.86 KB
Versions: 1
Compression:
Stored size: 1.86 KB
Contents
require 'spec_helper' describe Pacer::Transform::Path do before :all do @g = Pacer.tg 'spec/data/pacer.graphml' end describe '#paths' do it 'should return the paths between people and projects' do Set[*@g.v(:type => 'person').out_e.in_v(:type => 'project').paths.collect(&:to_a)].should == Set[[@g.vertex(0), @g.edge(0), @g.vertex(1)], [@g.vertex(5), @g.edge(1), @g.vertex(4)], [@g.vertex(5), @g.edge(13), @g.vertex(2)], [@g.vertex(5), @g.edge(12), @g.vertex(3)]] end it 'should include all elements traversed' do @g.v.out_e.in_v.paths.each do |path| path[0].should == @g path[1].should be_a(Pacer::TinkerVertex) path[2].should be_a(Pacer::TinkerEdge) path[3].should be_a(Pacer::TinkerVertex) path.length.should == 4 end end end describe '#transpose' do it 'should return the paths between people and projects' do transposed = @g.v(:type => 'person').out_e.in_v(:type => 'project').paths.transpose Set[*transposed].should == Set[[@g.vertex(0), @g.vertex(5), @g.vertex(5), @g.vertex(5)], [@g.edge(0), @g.edge(1), @g.edge(13), @g.edge(12)], [@g.vertex(1), @g.vertex(4), @g.vertex(2), @g.vertex(3)]] end end describe '#subgraph' do before do @sg = @g.v(:type => 'person').out_e.in_v(:type => 'project').subgraph @vertices = @g.v(:type => 'person').to_a + @g.v(:type => 'project').to_a @edges = @g.v(:type => 'person').out_e(:wrote) end it { Set[*@sg.v.element_ids].should == Set[*@vertices.collect { |v| v.element_id }] } it { Set[*@sg.e.element_ids].should == Set[*@edges.collect { |e| e.element_id }] } it { @sg.e.labels.uniq.to_a.should == ['wrote'] } it { Set[*@sg.v.collect { |v| v.properties }].should == Set[*@vertices.collect { |v| v.properties }] } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pacer-0.9.1.1-java | spec/pacer/transform/path_spec.rb |