public void setVertexType(BaseWork w, VertexType incomingVertexType) {
    VertexType vertexType = workVertexTypeMap.get(w);
    if (vertexType == null) {
      vertexType = VertexType.AUTO_INITIALIZED_EDGES;
    }
    switch (vertexType) {
    case INITIALIZED_EDGES:
      if (incomingVertexType == VertexType.MULTI_INPUT_UNINITIALIZED_EDGES) {
        vertexType = VertexType.MULTI_INPUT_INITIALIZED_EDGES;
      }
      break;

    case MULTI_INPUT_INITIALIZED_EDGES:
      // nothing to do
      break;

    case MULTI_INPUT_UNINITIALIZED_EDGES:
      if (incomingVertexType == VertexType.INITIALIZED_EDGES) {
        vertexType = VertexType.MULTI_INPUT_INITIALIZED_EDGES;
      }
      break;

    case AUTO_INITIALIZED_EDGES:
      vertexType = incomingVertexType;
      break;

    default:
      break;
    }
    workVertexTypeMap.put(w, vertexType);
  }
connect adds an edge between a and b. Both nodes have
to be added prior to calling connect.
ql/src/java/org/apache/hadoop/hive/ql/plan/TezWork.java