19 package org.turro.entities.graph;
21 import java.io.Writer;
22 import java.util.LinkedHashMap;
24 import org.jgrapht.Graphs;
25 import org.jgrapht.graph.DefaultEdge;
26 import org.jgrapht.graph.SimpleGraph;
27 import org.jgrapht.nio.Attribute;
28 import org.jgrapht.nio.DefaultAttribute;
29 import org.turro.graph.GraphUtil;
30 import org.turro.reflection.Instances;
31 import org.turro.string.Strings;
37 public class EntityGraph extends SimpleGraph<EntityVertex, DefaultEdge> {
41 private void addEdges() {
43 .forEach(p -> p.getEdges()
44 .forEach(e -> Graphs.addEdgeWithVertices(
this, e.getSource(), e.getTarget())));
49 public static void DOT(Writer writer) {
51 fi -> Strings.identifier(fi.getIdentifier()),
53 Map<String, Attribute> map = new LinkedHashMap<>();
54 map.put(
"color", DefaultAttribute.createAttribute(fi.getColor()));
55 map.put(
"fontcolor", DefaultAttribute.createAttribute(fi.getFontColor()));
56 map.put(
"label", DefaultAttribute.createAttribute(fi.getName()));
68 super(DefaultEdge.class);
static void DOT(Writer writer)
static EntityGraph load()