@Override
  public void updateEdgeMessage(int portNum) {
    if (portNum < _numParameterEdges) {
      // Port is a parameter input
      // Determine sample alpha and beta parameters
      // NOTE: This case works for either CategoricalUnnormalizedParameters or
      // CategoricalEnergyParameters factor functions
      // since the actual parameter value doesn't come into play in determining the message in this
      // direction

      GammaParameters outputMsg = (GammaParameters) _outputMsgs[portNum];

      // The parameter being updated corresponds to this value
      int parameterIndex = _factorFunction.getIndexByEdge(portNum);

      // Start with the ports to variable outputs
      int count = 0;
      for (int i = 0; i < _numOutputEdges; i++) {
        int outputIndex = _outputVariables[i].getCurrentSampleIndex();
        if (outputIndex == parameterIndex) count++;
      }

      // Include any constant outputs also
      if (_hasConstantOutputs) count += _constantOutputCounts[parameterIndex];

      outputMsg.setAlphaMinusOne(count); // Sample alpha
      outputMsg.setBeta(0); // Sample beta
    } else super.updateEdgeMessage(portNum);
  }