Skip to content
glejeune edited this page Sep 10, 2011 · 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();

  }
}

node-graphviz

by me : http://github.com/glejeune/node-graphviz

var sys = require('sys'),
  graphviz = require('../lib/graphviz');

// Create digraph G
var g = graphviz.digraph("G");

// Add node (ID: Hello)
var n1 = g.addNode( "Hello" );
n1.set( "color", "blue" );
n1.set( "style", "filled" );

// Add node (ID: World)
g.addNode( "World" );

// Add edge between the two nodes
var e = g.addEdge( n1, "World" );
e.set( "color", "red" );

// Print the dot script
console.log( g.to_dot() ); 

// Generate a PNG output
g.output( "png", "hello_world.png" );

erlang-graphviz

by me : http://github.com/glejeune/erlang-graphviz

% create digraph G
graphviz:digraph("G").

% Add edge A -> B
graphviz:add_edge("A", "B").

% Add edge B -> C
graphviz:add_edge("B", "C").

% Add edge B -> D
graphviz:add_edge("B", "D").

// Generate a PNG output
graphviz:to_file("test2.png", "png").
Clone this wiki locally