teverett / dot4j

A Java library for GraphViz DOT which enables both read and write of DOT files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CI

DOT4J

A Java library for reading and writing GraphViz DOT files.

The DOT grammar is from here

A formal description of DOT is available at graphviz.org

License

kGraphML is licensed under the 3-Clause BSD license.

Maven Coordinates

<groupId>com.khubla.dot4j</groupId>
<artifactId>dot4j</artifactId>
<version>1.2.0</version>
<packaging>jar</packaging>

Usage

Reading and writing of DOT files is done via DOTMarshaller

Reading DOT

Graph g = DOTMarshaller.importGraph(inputStream);

Writing DOT

Graph g = new Graph(false, GraphType.digraph, "mygraph");
Node n1 = new Node("n1");
g.addNode(n1);
Node n2 = new Node("node2");
g.addNode(n2);
Edge theEdge = new Edge("n1", "node2");
g.addEdge(theEdge);
DOTMarshaller.exportGraph(g, baos);

Creates:

digraph mygraph {
   node2;
   n1;
   n1 -> node2;
}

About

A Java library for GraphViz DOT which enables both read and write of DOT files

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Java 91.6%Language:ANTLR 8.4%