code: public static void marginals(final Hypergraph graph, final Hyperpotential w, final Algebra s,
              final Scores scores) {
          final int n = graph.getNodes().size();
          final double[] alpha = scores.alpha;
          final double[] beta = scores.beta;
          final double[] marginal = new double[n];
          int root = graph.getRoot().getId();
          
          // p(i) = \alpha_i * \beta_i / \beta_{root}
          for (Hypernode iNode : graph.getNodes()) {
              int i = iNode.getId();
              marginal[i] = s.divide(s.times(alpha[i], beta[i]), beta[root]); 
          }
          
          scores.marginal = marginal;
      }
docs: Computes the marginal for each hypernode.
  INPUT: scores.alpha, scores.beta.
  OUTPUT: scores.marginal.
  
  @param graph The hypergraph.
  @param w The potential function.
  @param s The semiring.
  @param scores Input and output struct.