Skip to content
glejeune edited this page Sep 13, 2010 · 4 revisions

Those projects were influenced by Ruby/GraphViz

IoGraphViz

by Sobe : http://github.com/Sobe/IoGraphViz

IoGraphViz

gv := IoGraphViz clone with("G")

hello := gv addNode("hello", nil)
world := gv addNode("world", nil)

gv addEdge(hello, world)

options := Map clone do(
  atPut("output", "png")
  atPut("file", "sample1.png")
)

gv output(options)

java-graphviz

by Everton Cardoso : http://github.com/vertocardoso/java-graphviz

package helloworld;

import com.couggi.javagraphviz.Digraph;
import com.couggi.javagraphviz.Graph;
import com.couggi.javagraphviz.GraphvizEngine;
import com.couggi.javagraphviz.Node;

public class HelloWorldSample {

  public static void main(String[] args) {
	
    // define a graph with the Digraph Type.
    Graph graph = new Digraph("G");
    // create nodes with names 
    Node hello = graph.addNode("Hello");
    Node world = graph.addNode("World");
    // create a edge with hello node and world node.
    graph.addEdge(hello, world);
    // create the Graphviz engine to the graph
    GraphvizEngine engine = new GraphvizEngine(graph);
    // define the type of the output 
    engine.type("png");
    // define the file name of the output.
    engine.toFilePath("helloworld.png");
    // generate output.
    engine.output();

  }
}
Clone this wiki locally