Introducing the GraphVizML gem

Prerequisites

Example

require 'graphvizml'

gvml = GraphVizML.new('gvml.xml')
gvml.to_png

Input file: gvml.xml

<gvml>
  <options>
    <summary/>
    <records>
      <option>
        <summary><type>node</type></summary>
        <records>
          <attribute><name>color</name><value>#ddaa66</value></attribute>
          <attribute><name>style</name><value>filled</value></attribute>
          <attribute><name>shape</name><value>box</value></attribute>                    
          <attribute><name>penwidth</name><value>1</value></attribute>          
          <attribute><name>fontname</name><value>Trebuchet MS</value></attribute>
          <attribute><name>fontsize</name><value>8</value></attribute>                    
          <attribute><name>fillcolor</name><value>#775500</value></attribute>                    
          <attribute><name>fontcolor</name><value>#ffeecc</value></attribute>          
          <attribute><name>margin</name><value>0.0</value></attribute>
        </records>
      </option>
      <option>
        <summary><type>edge</type></summary>
        <records>
          <attribute><name>color</name><value>#999999</value></attribute>
          <attribute><name>weight</name><value>1</value></attribute>
          <attribute><name>fontsize</name><value>6</value></attribute>                    
          <attribute><name>fontcolor</name><value>#444444</value></attribute>          
          <attribute><name>fontname</name><value>Verdana</value></attribute>
          <attribute><name>dir</name><value>forward</value></attribute>                    
          <attribute><name>arrowsize</name><value>0.5</value></attribute>          
        </records>    
      </option>  
    </records>
  </options>
  <nodes>
    <summary/>
    <records>
      <node id="123"><label>a</label></node>
      <node id="124"><label>b</label></node>    
      <node id="125"><label>c</label></node>
      <node id="126"><label>d</label></node>
      <node id="127"><label>e</label></node>    
    </records>
  </nodes>

  <edges>
    <summary/>
    <records>
      <edge id="201">
        <summary><label>smart1</label></summary>
        <records>
          <node id="123"><label>a</label></node>
          <node id="124"><label>b</label></node>    
        </records>
      </edge>
      <edge id="202">
        <summary><label>smart2</label></summary>
        <records>
          <node id="123"><label>a</label></node>
          <node id="125"><label>c</label></node>
         </records>
      </edge>
      <edge id="203">
        <summary><label>smart3</label></summary>
        <records>
          <node id="123"><label>a</label></node>
          <node id="126"><label>d</label></node>
        </records>
      </edge>
      <edge id="204">
        <summary><label>smart4</label></summary>
        <records>    
          <node id="123"><label>a</label></node>
          <node id="127"><label>e</label></node>    
        </records>
      </edge>
      <edge id="205">
        <summary><label>smart5</label></summary>
        <records>    
          <node id="124"><label>b</label></node>    
          <node id="127"><label>e</label></node>    
        </records>
      </edge>
      <edge id="206">
        <summary><label>smart6</label></summary>
        <records>    
          <node id="124"><label>b</label></node>    
          <node id="126"><label>d</label></node>
        </records>
      </edge>  
    </records>
  </edges>
</gvml>

Output:

screenshot of the output

Resources