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

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

本文整理了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

public static Graphviz fromGraph(Graph graph) {
  return fromGraph((MutableGraph) graph);
}

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

private Graphviz newGraphviz() {
    // Defaults to Rasterizer#BATIK
    return Graphviz.fromGraph(graphvizGraph)
        .engine(Engine.DOT)
        .height(calculateHeight(arcCount));
  }
}

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

private Graphviz newGraphviz() {
    // Defaults to Rasterizer#BATIK
    return Graphviz.fromGraph(graphvizGraph)
        .engine(Engine.DOT)
        .height(calculateHeight(arcCount));
  }
}

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

public static void workflowToPng(final Workflow workflow, final String fileName) throws IOException {
    final MutableGraph mg = Parser.read(workflowToDot(workflow));
    mg.setName(fileName);

    Graphviz.fromGraph(mg)
        .width(PNG_WIDTH)
        .render(Format.PNG)
        .toFile(new File(PARENT_FOLDER_NAME, FilenameUtils.getName(fileName)));
  }
}

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

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

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

public static void graphToPng(final Graph graph, final String fileName) throws IOException {
  if (!isProperJDKVersion()) {
    System.err.println("JDK version is not correct, omitting generating PNG from graph.");
    return;
  }
  final MutableGraph mg = Parser.read(graphToDot(graph));
  mg.setName(fileName);
  try {
    Graphviz.fromGraph(mg)
        .width(PNG_WIDTH)
        .render(Format.PNG)
        .toFile(new File(PARENT_FOLDER_NAME, FilenameUtils.getName(fileName)));
  }
  catch (final GraphvizException e) {
    throw new GraphvizException(String.format("Java version is %s", System.getProperty("java.version")), e);
  }
}

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

public static void workflowToPng(final Workflow workflow, final String fileName) throws IOException {
  if (!isProperJDKVersion()) {
    System.err.println("JDK version is not correct, omitting generating PNG from workflow.");
    return;
  }
  final MutableGraph mg = Parser.read(workflowToDot(workflow));
  mg.setName(fileName);
  try {
    Graphviz.fromGraph(mg)
        .width(PNG_WIDTH)
        .render(Format.PNG)
        .toFile(new File(PARENT_FOLDER_NAME, FilenameUtils.getName(fileName)));
  }
  catch (final GraphvizException e) {
    throw new GraphvizException(String.format("Java version is %s", System.getProperty("java.version")), e);
  }
}

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

public static Map<String, String> relationSvg(List<TableDefinition> tables) {
  final Map<String, String> relationSvg = new HashMap<>();
  for (TableDefinition table : tables) {
    final String cTable = table.getName();
    final Node[] cNode = {createNode(cTable).attr("weight", 8).attr("fillcolor", "grey75")};
    final Map<String, Node> refer = new HashMap<>();
    final Map<String, Node> referred = new HashMap<>();
    table.getColumns().forEach(column -> {
      column.getForeignKeys().forEach(fkey -> {
        final String rTable = fkey.getReferencedTable().getName();
        refer.putIfAbsent(rTable, createReferNode(rTable));
      });
      column.getUniqueKeys().forEach(ukey -> ukey.getForeignKeys().forEach(fkey -> {
        final String rTable = fkey.getKeyTable().getName();
        if (referred.get(rTable) == null && !cTable.equals(rTable))
          referred.put(rTable, createReferNode(rTable).link(cNode[0]));
      }));
    });
    refer.values().stream().distinct().forEach(rNode -> cNode[0] = cNode[0].link(rNode));
    final Graph g = graph(cTable).directed().node(cNode[0]);
    referred.values().stream().distinct().forEach(g::node);
    relationSvg.put(cTable, Graphviz.fromGraph(g).createSvg());
  }
  return relationSvg;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return Graphviz.fromGraph(TestUtil.toGraph(fwdNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});
log.eval(() -> {
 return Graphviz.fromGraph(TestUtil.toGraph(revNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});
log.eval(() -> {
 return Graphviz.fromGraph(TestUtil.toGraph(supervisedNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});

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

return Graphviz.fromGraph(TestUtil.toGraph(fwdNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});
log.eval(() -> {
 return Graphviz.fromGraph(TestUtil.toGraph(revNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});
log.eval(() -> {
 return Graphviz.fromGraph(TestUtil.toGraph(supervisedNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});

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

return Graphviz.fromGraph(TestUtil.toGraph(fwdNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});
log.eval(() -> {
 return Graphviz.fromGraph(TestUtil.toGraph(revNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});
log.eval(() -> {
 return Graphviz.fromGraph(TestUtil.toGraph(supervisedNetwork))
   .height(400).width(600).render(Format.PNG).toImage();
});

相关文章