code: public void connectTo(final AbstractJobVertex vertex, final ChannelType channelType, int indexOfOutputGate, int indexOfInputGate,
  			DistributionPattern distributionPattern)
  			throws JobGraphDefinitionException {
  
  		if (vertex == null) {
  			throw new JobGraphDefinitionException("Target vertex is null!");
  		}
  
  		if (indexOfOutputGate == -1) {
  			indexOfOutputGate = getFirstFreeOutputGateIndex();
  		}
  
  		// Make sure the array is big enough
  		for (int i = this.forwardEdges.size(); i <= indexOfOutputGate; i++) {
  			this.forwardEdges.add(null);
  		}
  
  		if (this.forwardEdges.get(indexOfOutputGate) != null) {
  			throw new JobGraphDefinitionException("Source vertex " + this.name + " already has an edge at index "
  				+ indexOfOutputGate);
  		}
  
  		if (indexOfInputGate == -1) {
  			indexOfInputGate = vertex.getFirstFreeInputGateIndex();
  		} else {
  			if (vertex.getBackwardConnection(indexOfInputGate) != null) {
  				throw new JobGraphDefinitionException("Target vertex " + vertex.getName()
  					+ " already has an edge at index " + indexOfInputGate);
  			}
  		}
  
  		// Add new edge
  		this.forwardEdges.set(indexOfOutputGate, new JobEdge(vertex, channelType, indexOfInputGate,
  			distributionPattern));
  		vertex.connectBacklink(this, channelType, indexOfOutputGate, indexOfInputGate,
  			distributionPattern);
  	}
docs: Connects the job vertex to the specified job vertex.
  
  @param vertex
  the vertex this vertex should connect to
  @param channelType
  the channel type the two vertices should be connected by at runtime
  @param compressionLevel
  the compression level the corresponding channel should have at runtime
  @param indexOfOutputGate
  index of the producing task's output gate to be used, <code>-1</code> will determine the next free index
  number
  @param indexOfInputGate
  index of the consuming task's input gate to be used, <code>-1</code> will determine the next free index
  number
  @throws JobGraphDefinitionException
  thrown if the given vertex cannot be connected to <code>vertex</code> in the requested manner