+ g1 = Graph.new
+ g2 = Graph.new
+ g1v1 = Vertex.new(:name => :g1v1)
+ g1v2 = Vertex.new(:name => :g1v2)
+ g1v3 = Vertex.new(:name => :g1v3)
+ g1.connect(g1v1, g1v2)
+ g1.connect(g1v2, g1v3)
+ g2v1 = Vertex.new(:name => :g2v1)
+ g2v2 = Vertex.new(:name => :g2v2)
+ g2v3 = Vertex.new(:name => :g2v3)
+ g2.connect(g2v1, g2v2)
+ g2.connect(g2v2, g2v3)
+ pg = g1.product g2
+
+ pg.should have(9).vertices
+ pg.should have(8).edges
+ end
+
+ it "finds a product graph of a simple graph with edge types" do
+ g1 = Graph.new
+ g2 = Graph.new
+ g1v1 = Vertex.new(:name => :g1v1)
+ g1v2 = Vertex.new(:name => :g1v2)
+ g1v3 = Vertex.new(:name => :g1v3)
+ g1.connect(g1v1, g1v2, :type => :t1)
+ g1.connect(g1v2, g1v3, :type => :t2)
+ g2v1 = Vertex.new(:name => :g2v1)
+ g2v2 = Vertex.new(:name => :g2v2)
+ g2v3 = Vertex.new(:name => :g2v3)
+ g2.connect(g2v1, g2v2, :type => :t1)
+ g2.connect(g2v2, g2v3, :type => :t2)
+ pg = g1.product g2
+
+ pg.should have(7).vertices
+ pg.should have(4).edges
+ end
+
+ it "finds a product graph of the example graph from paper" do
+ pending "implementation of directed graphs as operands of the product graph"
+ g1 = Graph.new
+ g2 = Graph.new
+ a = Vertex.new(:name => :a)
+ a1 = Vertex.new(:name => :a1)
+ a2 = Vertex.new(:name => :a2)
+ g1.connect(a, a1, :type => :l1)
+ g1.connect(a, a2, :type => :l1)
+ g1.connect(a1, a2, :type => :l2)
+ b = Vertex.new(:name => :b)
+ b1 = Vertex.new(:name => :b1)
+ b2 = Vertex.new(:name => :b2)
+ g2.connect(b, b1, :type => :l1)
+ g2.connect(b, b2, :type => :l2)
+ g2.connect(b1, b2, :type => :l2)
+ pg = g1.product g2
+
+ pg.should have(4).edges
+ pg.should have(6).vertices