Sha256: a608568f89cfbb37fe00cf4ba1a95574a5bf1c389a4b63d4596063e357fd1af4

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 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 close
      @output_file << "}"
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphshaper-0.2.2 lib/graphshaper/adapters/dot_adapter.rb