class DotPointerGraph {
  private static final Logger logger = LoggerFactory.getLogger(DotPointerGraph.class);

  private final Set<String> edges = new HashSet<String>();

  private final Set<Node> nodes = new HashSet<Node>();

  public void addAssign(VarNode from, VarNode to) {
    addEdge(to, from, "", "black");
  }

  private void addEdge(Node from, Node to, String edgeLabel, String color) {
    nodes.add(from);
    nodes.add(to);
    addEdge(PagToDotDumper.makeNodeName(from), PagToDotDumper.makeNodeName(to), edgeLabel, color);
  }

  private void addEdge(String from, String to, String edgeLabel, String color) {
    StringBuffer tmp = new StringBuffer();
    tmp.append("    ");
    tmp.append(from);
    tmp.append(" -> ");
    tmp.append(to);
    tmp.append(" [label=\"");
    tmp.append(edgeLabel);
    tmp.append("\", color=");
    tmp.append(color);
    tmp.append("];");
    edges.add(tmp.toString());
  }

  public void addNew(AllocNode from, VarNode to) {
    addEdge(to, from, "", "yellow");
  }

  public void addCall(VarNode from, VarNode to, Integer callSite) {
    addEdge(to, from, callSite.toString(), "blue");
  }

  public void addMatch(VarNode from, VarNode to) {
    addEdge(to, from, "", "brown");
  }

  public void addLoad(FieldRefNode from, VarNode to) {
    addEdge(to, from.getBase(), from.getField().toString(), "green");
  }

  public void addStore(VarNode from, FieldRefNode to) {
    addEdge(to.getBase(), from, to.getField().toString(), "red");
  }

  public int numEdges() {
    return edges.size();
  }

  public void dump(String filename) {<FILL_FUNCTION_BODY>}
}

    PrintWriter pw = null;
    try {
      pw = new PrintWriter(new FileOutputStream(filename));
    } catch (FileNotFoundException e) {
      logger.error(e.getMessage(), e);
    }
    // pw.println("digraph G {\n\trankdir=LR;");
    pw.println("digraph G {");
    Predicate<Node> falsePred = new Predicate<Node>() {

      @Override
      public boolean test(Node obj_) {
        return false;
      }

    };
    for (Node node : nodes) {
      pw.println(PagToDotDumper.makeDotNodeLabel(node, falsePred));
    }
    for (String edge : edges) {
      pw.println(edge);
    }
    pw.println("}");
    pw.close();

  
<no_super_class>