public void print(Printer printer, int indentFlag, String type, Vertex callingVertex) throws Exception {
    // print vertexname
    if (parser.printSet.contains(this) && numReduceOp <= 1) {
      if (type != null) {
        printer.println(DagJsonParser.prefixString(indentFlag, "<-")
            + " Please refer to the previous " + this.name + " [" + type + "]");
      } else {
        printer.println(DagJsonParser.prefixString(indentFlag, "<-")
            + " Please refer to the previous " + this.name);
      }
      return;
    }
    parser.printSet.add(this);
    if (type != null) {
      printer.println(DagJsonParser.prefixString(indentFlag, "<-") + this.name + " [" + type + "]"
          + this.executionMode);
    } else if (this.name != null) {
      printer.println(DagJsonParser.prefixString(indentFlag) + this.name + this.executionMode);
    }
    // print operators
    if (numReduceOp > 1 && !(callingVertex.vertexType == VertexType.UNION)) {
      // find the right op
      Op choose = null;
      for (Op op : this.outputOps) {
        // op.outputVertexName may be null
        if (callingVertex.name.equals(op.outputVertexName)) {
          choose = op;
        }
      }
      if (choose != null) {
        choose.print(printer, indentFlag, false);
      } else {
        throw new Exception("Can not find the right reduce output operator for vertex " + this.name);
      }
    } else {
      for (Op op : this.outputOps) {
        // dummy vertex is treated as a branch of a join operator
        if (this.dummy) {
          op.print(printer, indentFlag, true);
        } else {
          op.print(printer, indentFlag, false);
        }
      }
    }
    if (vertexType == VertexType.UNION) {
      // print dependent vertices
      indentFlag++;
      for (int index = 0; index < this.parentConnections.size(); index++) {
        Connection connection = this.parentConnections.get(index);
        connection.from.print(printer, indentFlag, connection.type, this);
      }
    }
  }
@param object
@param parent
@return
@throws Exception
          assumption: each operator only has one parent but may have many
          children
common/src/java/org/apache/hadoop/hive/common/jsonexplain/Vertex.java