Sha256: b7c94c1232c9a4c1fba58b750f374b7672aedafc2e16e90c5aa0a31a6f1eb6a4

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 Bytes

Contents

module Graphshaper
  class DotAdapter
    def initialize(output_file)
      @output_file = output_file
      @output_file << "digraph genereated_graph { \n  rankdir=LR;\n  node [shape = circle];\n  edge [dir=none];\n"
    end
    
    def add_edge(edge_id, in_id, out_id)
      @output_file << "  #{in_id} -> #{out_id} [ label = \"#{edge_id}\" ];\n"
    end
    
    def add_vertex(vertex_id)
      @output_file << "  #{vertex_id};\n"
    end
    
    def close
      @output_file << "}"
      @output_file.close
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphshaper-0.2.4 lib/graphshaper/adapters/dot_adapter.rb
graphshaper-0.2.3 lib/graphshaper/adapters/dot_adapter.rb