Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teverett/elk4j
https://github.com/teverett/elk4j
Last synced: 24 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 (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-17T00:22:20.000Z (about 3 years ago)
- Last Synced: 2023-07-01T10:40:58.020Z (over 1 year 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
![CI](https://github.com/teverett/dot4j/workflows/CI/badge.svg)
# 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;
}```