public GraphPrintVisitor beginGraph(String graphName) { if (null == groupElement) { beginGroup(""); } else if (null != prevNodeMap) { // TODO: difference (create removeNode,removeEdge elements) } graphElement = dom.createElement("graph"); groupElement.appendChild(graphElement); Element properties = dom.createElement("properties"); graphElement.appendChild(properties); nodesElement = dom.createElement("nodes"); graphElement.appendChild(nodesElement); edgesElement = dom.createElement("edges"); graphElement.appendChild(edgesElement); // set graph name Element propName = dom.createElement("p"); propName.setAttribute("name", "name"); propName.setTextContent(graphName); properties.appendChild(propName); // save old nodes prevNodeMap = nodeMap; nodeMap = new IdentityHashMap<>(); edgeList = new ArrayList<>(); return this; }
/** @since 0.8 or earlier */ public GraphPrintVisitor beginGraph(String graphName) { ensureOpen(); if (openGroupCount == 0) { beginGroup(graphName); } maybeEndGraph(); openGraphCount++; this.currentGraphName = graphName; // save old nodes prevNodeMap = nodeMap; nodeMap = new IdentityHashMap<>(); edgeList = new ArrayList<>(); return this; }
/** @since 0.8 or earlier */ public GraphPrintVisitor beginGraph(String graphName) { ensureOpen(); if (openGroupCount == 0) { beginGroup(graphName); } maybeEndGraph(); openGraphCount++; this.currentGraphName = graphName; // save old nodes prevNodeMap = nodeMap; nodeMap = new IdentityHashMap<>(); edgeList = new ArrayList<>(); return this; }
private static void dumpIGV() { com.oracle.truffle.api.nodes.GraphPrintVisitor printer = new com.oracle.truffle.api.nodes.GraphPrintVisitor(); printer.beginGroup("shapes"); IGVShapeVisitor visitor = new IGVShapeVisitor(printer); for (ShapeImpl shape : getAllShapes()) { if (isRootShape(shape)) { printer.beginGraph(getId(shape) + " (" + calcShapeGraphSize(shape) + ") (" + shape.getObjectType() + ")"); visitor.visitShape(shape); printer.endGraph(); } } printer.beginGraph("all shapes"); for (ShapeImpl shape : getAllShapes()) { if (isRootShape(shape)) { visitor.visitShape(shape); } } printer.endGraph(); printer.endGroup(); printer.printToNetwork(false); }
private static void dumpIGV() { com.oracle.truffle.api.nodes.GraphPrintVisitor printer = new com.oracle.truffle.api.nodes.GraphPrintVisitor(); printer.beginGroup("shapes"); IGVShapeVisitor visitor = new IGVShapeVisitor(printer); for (ShapeImpl shape : getAllShapes()) { if (isRootShape(shape)) { printer.beginGraph(getId(shape) + " (" + calcShapeGraphSize(shape) + ") (" + shape.getObjectType() + ")"); visitor.visitShape(shape); printer.endGraph(); } } printer.beginGraph("all shapes"); for (ShapeImpl shape : getAllShapes()) { if (isRootShape(shape)) { visitor.visitShape(shape); } } printer.endGraph(); printer.endGroup(); printer.printToNetwork(false); }