https://github.com/adibaba/java-yed
A yEd graph file generator written in Java
https://github.com/adibaba/java-yed
graphml graphviz java xml yed yworks
Last synced: 2 months ago
JSON representation
A yEd graph file generator written in Java
- Host: GitHub
- URL: https://github.com/adibaba/java-yed
- Owner: adibaba
- Created: 2019-11-17T10:29:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T17:33:13.000Z (over 4 years ago)
- Last Synced: 2023-10-20T16:10:51.545Z (over 1 year ago)
- Topics: graphml, graphviz, java, xml, yed, yworks
- Language: Java
- Homepage:
- Size: 149 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java yEd
This is a yEd graph file generator written in Java.
It allows to create:- Nodes with labels
- Node types (optional)
- Directed edges between two nodes
- Edge labels (optional)
- Edge types (optional)
## Code examples
Example code is available in the following files:
- [Examples.java](src/main/java/de/adrianwilke/javayed/Examples.java)
- [YedDocTest.java](src/test/java/de/adrianwilke/javayed/YedDocTest.java)
- [IoTest.java](src/test/java/de/adrianwilke/javayed/IoTest.java)### Example A
```java
// Set file to write
File file = new File("exampleA.yEd.graphml");
System.out.println("Example file: " + file.getAbsolutePath());// Create document
YedDoc yedDoc = new YedDoc().initialize();// Create nodes
String a = yedDoc.createNode("Adrian");
String b = yedDoc.createNode("Benjamin");
String c = yedDoc.createNode("Caesar");// Create edges
yedDoc.createEdge(a, b);
yedDoc.createEdge(b, c);
yedDoc.createEdge(c, a);// Write file
Io.write(yedDoc.getDocument(), file);
```### Example B
```java
// Set file to write
File file = new File("exampleB.yEd.graphml");
System.out.println("Example file: " + file.getAbsolutePath());// Create and configure a document
YedDoc yedDoc = new YedDoc().initialize();
yedDoc.setFontFamily("Roboto");
yedDoc.setFontSize(14);
yedDoc.setFontStyle("bold");// Create nodes of different types
int hero = 0;
String s = yedDoc.createNode("Superman", hero);
String b = yedDoc.createNode("Batman", hero);
String h = yedDoc.createNode("Harley Quinn", hero);
int robot = 1;
String r = yedDoc.createNode("Robocob", robot);
String t = yedDoc.createNode("T-1000 ", robot);// Create edges of different types
int knows = 0;
String knowsLabel = "knows";
yedDoc.createEdge(s, b, knowsLabel, knows);
yedDoc.createEdge(t, s, knowsLabel, knows);
int loves = 1;
String lovesLabel = "loves";
yedDoc.createEdge(s, h, lovesLabel, loves);
yedDoc.createEdge(b, h, lovesLabel, loves);
yedDoc.createEdge(h, t, lovesLabel, loves);
Integer unknown = null;
String unknownLabel = null;
yedDoc.createEdge(r, h, unknownLabel, unknown);// Write file
Io.write(yedDoc.getDocument(), file);
```## How to use the yEd Graph Editor
- Download yEd at https://www.yworks.com/products/yed
- Open a generated file
- Click `Tools` > `Fit Node to Label` > Ok
- Click `Layout` > `Organic` (e.g.) > Ok
- At `Palette` > `Current Elements` right-click on an element and click `Select Matching Elements`
- Customize the elements according to your tasteYou can also use yEd Live at https://www.yworks.com/yed-live/
## Usage
Download the latest
[release](https://github.com/adibaba/java-yed/releases)
or current
[code](https://github.com/adibaba/java-yed/archive/master.zip).### Usage of Maven and GitHub Packages
Add the following lines to your pom.xml:
```xml
de.adrianwilke
java-yed
(0,1]
[...]
github-adibaba-java-yed
GitHub adibaba java-yed Apache Maven Packages
https://maven.pkg.github.com/adibaba/java-yed
```
To use GitHub Packages, you also have to edit your Maven settings.xml and to create a personal access token.
A description on how to set up the settings.xml is available at [GitHub Help: Configuring Apache Maven for use with GitHub Packages](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-apache-maven-for-use-with-github-packages#authenticating-to-github-packages).
Token creation is described at [GitHub Help: Creating a personal access token for the command line](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).## Deployment
- Remove "-SNAPSHOT" from version
- Create a tag, e.g. `git tag -a 0.0.0 -m "0.0.0"`
- Push the tag: `git push --tags`
- Create a release from [tags/](https://github.com/adibaba/java-yed/tags)
- Run mvn install and attach binaries to the release
- Create new "-SNAPSHOT" version