def render(format = 'png', layout = 'dot')
      Libgvc.gvLayout(@@gvc, ptr, layout.to_s)

      data_ptr = FFI::MemoryPointer.new(:pointer, 1)
      len_ptr = FFI::MemoryPointer.new(:int, 1)

      Libgvc.gvRenderData(@@gvc, ptr, format.to_s, data_ptr, len_ptr)
      len = len_ptr.read_uint
      data_ptr = data_ptr.read_pointer

      data = data_ptr.read_string len

      Libgvc.gvFreeRenderData(data_ptr)
      Libgvc.gvFreeLayout(@@gvc, ptr)

      data
    end
def render(format = 'png', layout = 'dot')
      Libgvc.gvLayout(@@gvc, ptr, layout.to_s)

      data_ptr = FFI::MemoryPointer.new(:pointer, 1)
      len_ptr = FFI::MemoryPointer.new(:int, 1)

      Libgvc.gvRenderData(@@gvc, ptr, format.to_s, data_ptr, len_ptr)
      len = len_ptr.read_uint
      data_ptr = data_ptr.read_pointer

      data = data_ptr.read_string len

      Libgvc.gvFreeRenderData(data_ptr)
      Libgvc.gvFreeLayout(@@gvc, ptr)

      data
    end
Renders the graph to an image and returns the result as a string
 @param format [String] the image format to use, e.g. 'svg', 'pdf' etc.
 @param layout [String] the layout to use, e.g. 'dot' or 'neato' etc.
 @return [String] the rendered graph in the given format