https://github.com/teverett/elk4j
https://github.com/teverett/elk4j
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/teverett/elk4j
- Owner: teverett
- License: bsd-3-clause
- Created: 2020-11-09T22:16:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-17T00:22:20.000Z (almost 4 years ago)
- Last Synced: 2025-03-18T05:44:12.475Z (4 months ago)
- Language: Java
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# ELK4J
A Java library for reading and writing [ELK](https://www.eclipse.org/elk/) [JSON](https://www.eclipse.org/elk/documentation/tooldevelopers/graphdatastructure/jsonformat.html)
# License
ELK4J is licensed under the 3-Clause BSD license.
# Maven Coordinates
```
com.khubla.elk4j
elk4j
1.0.0
jar
```# Usage
Reading and writing of DOT files is done via [ELKMarshaller](https://github.com/teverett/dot4j/blob/master/src/main/java/com/khubla/dot4j/DOTMarshaller.java)
## 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;
}```