+ describe '#to_dot' do
+ it 'gives the dot notation of a simple graph' do
+ v1 = Vertex.new(:name => :v1)
+ v2 = Vertex.new(:name => :v2)
+ g.connect(v1, v2, :type => :edge_type)
+ g.to_dot.should == "graph {\n#{v1.object_id.to_s};\n#{v2.object_id.to_s};\n#{v1.object_id.to_s} -- #{v2.object_id.to_s};\n}"
+ end
+
+ it "gives the dot notation of a simple graph, with vertex attributes" do
+ v1 = Vertex.new(:name => :v1)
+ v2 = Vertex.new(:name => :v2)
+ g.connect(v1, v2, :type => :edge_type)
+ gdot = g.to_dot(:vertex_args => {:label => :name})
+ gdot.should == "graph {\n#{v1.object_id.to_s} {label = \"#{v1.name}\"};\n#{v2.object_id.to_s} {label = \"#{v2.name}\"};\n#{v1.object_id.to_s} -- #{v2.object_id.to_s};\n}"
+ end
+
+ it "gives the dot notation of a simple graph, with vertices generated by a block" do
+ v1 = Vertex.new(:name => :v1)
+ v2 = Vertex.new(:name => :v2)
+ g.connect(v1, v2, :type => :edge_type)
+ gdot = g.to_dot(:vertex_block => lambda {|v| v.name})
+ gdot.should == "graph {\n#{v1.name};\n#{v2.name};\n#{v1.object_id.to_s} -- #{v2.object_id.to_s};\n}"
+ end
+
+ end # #to_dot
+
+ describe 'product' do
+ it 'finds a product graph of a pair of one-vertex graphs' do