MCPcopy Create free account
hub / github.com/LFYSec/MScan / dump

Method dump

src/main/java/pascal/taie/util/graph/DotDumper.java:122–140  ·  view source on GitHub ↗
(Graph<N> graph, File output)

Source from the content-addressed store, hash-verified

120 }
121
122 public void dump(Graph<N> graph, File output) {
123 try (PrintStream out = new PrintStream(new FileOutputStream(output))) {
124 this.out = out;
125 // dump starts
126 out.println("digraph G {");
127 // dump global node attributes
128 out.printf("%snode [%s];%n", INDENT, globalNodeAttrs);
129 // dump global edge attributes
130 out.printf("%sedge [%s];%n", INDENT, globalEdgeAttrs);
131 // dump nodes
132 graph.forEach(this::dumpNode);
133 // dump edges
134 graph.forEach(n -> graph.getOutEdgesOf(n).forEach(this::dumpEdge));
135 // dump ends
136 out.println("}");
137 } catch (FileNotFoundException e) {
138 logger.warn("Failed to dump graph to {}", output.getAbsolutePath(), e);
139 }
140 }
141
142 private void dumpNode(N node) {
143 dumpElement(node, this::nodeToString, nodeLabeler, nodeAttributer);

Callers 1

dumpOAGMethod · 0.45

Calls 2

forEachMethod · 0.65
getOutEdgesOfMethod · 0.65

Tested by 1

dumpOAGMethod · 0.36