code: function (ep, elementWithPrecedence) {
  		var idx = 0;
  		if (elementWithPrecedence != null) {
  			for (var i = 0; i < ep.connections.length; i++) {
  				if (ep.connections[i].sourceId == elementWithPrecedence || ep.connections[i].targetId == elementWithPrecedence) {
  					idx = i;
  					break;
  				}
  			}
  		}
  
  		return ep.connections[idx];
  	}
docs: a helper function that tries to find a connection to the given element, and returns it if so. if elementWithPrecedence is null, or no connection to it is found, we return the first connection in our list.