guru.nidi.graphviz.engine.Graphviz.fromGraph()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(246)

本文整理了Java中guru.nidi.graphviz.engine.Graphviz.fromGraph()方法的一些代码示例,展示了Graphviz.fromGraph()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphviz.fromGraph()方法的具体详情如下:
包路径:guru.nidi.graphviz.engine.Graphviz
类名称:Graphviz
方法名:fromGraph

Graphviz.fromGraph介绍

暂无

代码示例

代码示例来源:origin: nidi3/graphviz-java

  1. public static Graphviz fromGraph(Graph graph) {
  2. return fromGraph((MutableGraph) graph);
  3. }

代码示例来源:origin: apache/oozie

  1. private Graphviz newGraphviz() {
  2. // Defaults to Rasterizer#BATIK
  3. return Graphviz.fromGraph(graphvizGraph)
  4. .engine(Engine.DOT)
  5. .height(calculateHeight(arcCount));
  6. }
  7. }

代码示例来源:origin: org.apache.oozie/oozie-core

  1. private Graphviz newGraphviz() {
  2. // Defaults to Rasterizer#BATIK
  3. return Graphviz.fromGraph(graphvizGraph)
  4. .engine(Engine.DOT)
  5. .height(calculateHeight(arcCount));
  6. }
  7. }

代码示例来源:origin: org.apache.oozie/oozie-fluent-job-api

  1. public static void workflowToPng(final Workflow workflow, final String fileName) throws IOException {
  2. final MutableGraph mg = Parser.read(workflowToDot(workflow));
  3. mg.setName(fileName);
  4. Graphviz.fromGraph(mg)
  5. .width(PNG_WIDTH)
  6. .render(Format.PNG)
  7. .toFile(new File(PARENT_FOLDER_NAME, FilenameUtils.getName(fileName)));
  8. }
  9. }

代码示例来源:origin: org.apache.oozie/oozie-fluent-job-api

  1. public static void graphToPng(final Graph graph, final String fileName) throws IOException {
  2. final MutableGraph mg = Parser.read(graphToDot(graph));
  3. mg.setName(fileName);
  4. Graphviz.fromGraph(mg)
  5. .width(PNG_WIDTH)
  6. .render(Format.PNG)
  7. .toFile(new File(PARENT_FOLDER_NAME, FilenameUtils.getName(fileName)));
  8. }

代码示例来源:origin: apache/oozie

  1. public static void graphToPng(final Graph graph, final String fileName) throws IOException {
  2. if (!isProperJDKVersion()) {
  3. System.err.println("JDK version is not correct, omitting generating PNG from graph.");
  4. return;
  5. }
  6. final MutableGraph mg = Parser.read(graphToDot(graph));
  7. mg.setName(fileName);
  8. try {
  9. Graphviz.fromGraph(mg)
  10. .width(PNG_WIDTH)
  11. .render(Format.PNG)
  12. .toFile(new File(PARENT_FOLDER_NAME, FilenameUtils.getName(fileName)));
  13. }
  14. catch (final GraphvizException e) {
  15. throw new GraphvizException(String.format("Java version is %s", System.getProperty("java.version")), e);
  16. }
  17. }

代码示例来源:origin: apache/oozie

  1. public static void workflowToPng(final Workflow workflow, final String fileName) throws IOException {
  2. if (!isProperJDKVersion()) {
  3. System.err.println("JDK version is not correct, omitting generating PNG from workflow.");
  4. return;
  5. }
  6. final MutableGraph mg = Parser.read(workflowToDot(workflow));
  7. mg.setName(fileName);
  8. try {
  9. Graphviz.fromGraph(mg)
  10. .width(PNG_WIDTH)
  11. .render(Format.PNG)
  12. .toFile(new File(PARENT_FOLDER_NAME, FilenameUtils.getName(fileName)));
  13. }
  14. catch (final GraphvizException e) {
  15. throw new GraphvizException(String.format("Java version is %s", System.getProperty("java.version")), e);
  16. }
  17. }

代码示例来源:origin: org.tinywind/scheme-reporter

  1. public static Map<String, String> relationSvg(List<TableDefinition> tables) {
  2. final Map<String, String> relationSvg = new HashMap<>();
  3. for (TableDefinition table : tables) {
  4. final String cTable = table.getName();
  5. final Node[] cNode = {createNode(cTable).attr("weight", 8).attr("fillcolor", "grey75")};
  6. final Map<String, Node> refer = new HashMap<>();
  7. final Map<String, Node> referred = new HashMap<>();
  8. table.getColumns().forEach(column -> {
  9. column.getForeignKeys().forEach(fkey -> {
  10. final String rTable = fkey.getReferencedTable().getName();
  11. refer.putIfAbsent(rTable, createReferNode(rTable));
  12. });
  13. column.getUniqueKeys().forEach(ukey -> ukey.getForeignKeys().forEach(fkey -> {
  14. final String rTable = fkey.getKeyTable().getName();
  15. if (referred.get(rTable) == null && !cTable.equals(rTable))
  16. referred.put(rTable, createReferNode(rTable).link(cNode[0]));
  17. }));
  18. });
  19. refer.values().stream().distinct().forEach(rNode -> cNode[0] = cNode[0].link(rNode));
  20. final Graph g = graph(cTable).directed().node(cNode[0]);
  21. referred.values().stream().distinct().forEach(g::node);
  22. relationSvg.put(cTable, Graphviz.fromGraph(g).createSvg());
  23. }
  24. return relationSvg;
  25. }

代码示例来源:origin: org.tinywind/scheme-reporter

  1. public static String totalRelationSvg(List<TableDefinition> tables) {
  2. final Map<String, Node> nodeMap = tables.stream().collect(Collectors.toMap(Definition::getName, table -> createReferNode(table.getName())));
  3. final Graph g = graph("totalRelationSvg").directed()
  4. .general().attr(RankDir.LEFT_TO_RIGHT);
  5. final List<Pair<String, String>> linkedList = new ArrayList<>();
  6. tables.forEach(table -> table.getColumns().forEach(column -> column.getForeignKeys().forEach(fkey -> {
  7. if (linkedList.contains(new Pair<>(table.getName(), fkey.getReferencedTable().getName()))) return;
  8. final Node linked = nodeMap.get(fkey.getReferencedTable().getName());
  9. nodeMap.put(table.getName(), nodeMap.get(table.getName()).link(linked));
  10. linkedList.add(new Pair<>(table.getName(), fkey.getReferencedTable().getName()));
  11. })));
  12. nodeMap.forEach((name, node) -> g.node(node));
  13. return Graphviz.fromGraph(g).createSvg();
  14. }

代码示例来源:origin: com.simiacryptus/mindseye-test

  1. log.h3("Network Diagram");
  2. log.eval(() -> {
  3. return Graphviz.fromGraph(TestUtil.toGraph(network))
  4. .height(400).width(600).render(Format.PNG).toImage();
  5. });

代码示例来源:origin: com.simiacryptus/mindseye-labs

  1. log.h3("Network Diagram");
  2. log.eval(() -> {
  3. return Graphviz.fromGraph(TestUtil.toGraph(network))
  4. .height(400).width(600).render(Format.PNG).toImage();
  5. });

代码示例来源:origin: com.simiacryptus/mindseye

  1. log.h3("Network Diagram");
  2. log.eval(() -> {
  3. return Graphviz.fromGraph(TestUtil.toGraph(network))
  4. .height(400).width(600).render(Format.PNG).toImage();
  5. });

代码示例来源:origin: com.simiacryptus/mindseye-labs

  1. log.p("This is a network apply the following layout:");
  2. log.eval(() -> {
  3. return Graphviz.fromGraph(TestUtil.toGraph((DAGNetwork) smallLayer))
  4. .height(400).width(600).render(Format.PNG).toImage();
  5. });
  6. @Nonnull DAGNetwork network = (DAGNetwork) explode;
  7. log.eval(() -> {
  8. @Nonnull Graphviz graphviz = Graphviz.fromGraph(TestUtil.toGraph(network)).height(400).width(600);
  9. @Nonnull File file = new File(log.getResourceDir(), log.getName() + "_network.svg");
  10. graphviz.render(Format.SVG_STANDALONE).toFile(file);

代码示例来源:origin: com.simiacryptus/mindseye

  1. log.p("This is a network apply the following layout:");
  2. log.eval(() -> {
  3. return Graphviz.fromGraph(TestUtil.toGraph((DAGNetwork) smallLayer))
  4. .height(400).width(600).render(Format.PNG).toImage();
  5. });
  6. @Nonnull DAGNetwork network = (DAGNetwork) explode;
  7. log.eval(() -> {
  8. @Nonnull Graphviz graphviz = Graphviz.fromGraph(TestUtil.toGraph(network)).height(400).width(600);
  9. @Nonnull File file = new File(log.getResourceDir(), log.getName() + "_network.svg");
  10. graphviz.render(Format.SVG_STANDALONE).toFile(file);

代码示例来源:origin: com.simiacryptus/mindseye-test

  1. log.h3("Network Diagram");
  2. log.eval(() -> {
  3. return Graphviz.fromGraph(TestUtil.toGraph(imageNetwork))
  4. .height(400).width(600).render(Format.PNG).toImage();
  5. });

代码示例来源:origin: nidi3/graphviz-java

  1. public static void createFontTest(String name, double adjust, File output) throws IOException {
  2. final Node width = node("If text is too narrow, increase fontAdjust. If it's too wide, decrease it.");
  3. final Node center = node(Label.html("A very long node label that should be centered inside the border<br/>"
  4. + "If text is too much left, increase fontAdjust.<br/>"
  5. + "If it's too much right, decrease it."));
  6. Graphviz.fromGraph(graph()
  7. .nodeAttr().with(Font.name(name), Shape.RECTANGLE)
  8. .with(width.link(center)))
  9. .fontAdjust(adjust)
  10. .render(PNG)
  11. .toFile(output);
  12. }

代码示例来源:origin: com.simiacryptus/mindseye

  1. log.h3("Network Diagram");
  2. log.eval(() -> {
  3. return Graphviz.fromGraph(TestUtil.toGraph(imageNetwork))
  4. .height(400).width(600).render(Format.PNG).toImage();
  5. });

代码示例来源:origin: com.simiacryptus/mindseye

  1. return Graphviz.fromGraph(TestUtil.toGraph(fwdNetwork))
  2. .height(400).width(600).render(Format.PNG).toImage();
  3. });
  4. log.eval(() -> {
  5. return Graphviz.fromGraph(TestUtil.toGraph(revNetwork))
  6. .height(400).width(600).render(Format.PNG).toImage();
  7. });
  8. log.eval(() -> {
  9. return Graphviz.fromGraph(TestUtil.toGraph(supervisedNetwork))
  10. .height(400).width(600).render(Format.PNG).toImage();
  11. });

代码示例来源:origin: com.simiacryptus/mindseye-test

  1. return Graphviz.fromGraph(TestUtil.toGraph(fwdNetwork))
  2. .height(400).width(600).render(Format.PNG).toImage();
  3. });
  4. log.eval(() -> {
  5. return Graphviz.fromGraph(TestUtil.toGraph(revNetwork))
  6. .height(400).width(600).render(Format.PNG).toImage();
  7. });
  8. log.eval(() -> {
  9. return Graphviz.fromGraph(TestUtil.toGraph(supervisedNetwork))
  10. .height(400).width(600).render(Format.PNG).toImage();
  11. });

代码示例来源:origin: com.simiacryptus/mindseye-labs

  1. return Graphviz.fromGraph(TestUtil.toGraph(fwdNetwork))
  2. .height(400).width(600).render(Format.PNG).toImage();
  3. });
  4. log.eval(() -> {
  5. return Graphviz.fromGraph(TestUtil.toGraph(revNetwork))
  6. .height(400).width(600).render(Format.PNG).toImage();
  7. });
  8. log.eval(() -> {
  9. return Graphviz.fromGraph(TestUtil.toGraph(supervisedNetwork))
  10. .height(400).width(600).render(Format.PNG).toImage();
  11. });

相关文章