code: public static double parseSingleRoot(double[] fracRoot, double[][] fracChild, int[] parents) {
          assert (parents.length == fracRoot.length);
          assert (fracChild.length == fracRoot.length);    
  
          final int n = parents.length;
          final ProjTreeChart c = new ProjTreeChart(n+1, DepParseType.VITERBI);
          insideAlgorithm(EdgeScores.combine(fracRoot, fracChild), c, true);
          
          // Trace the backpointers to extract the parents.        
          Arrays.fill(parents, -2);
          // Get the head of the sentence.
          int head = c.getBp(0, n, RIGHT, COMPLETE);
          parents[head-1] = -1; // The wall (-1) is its parent.
          // Extract parents left of the head.
          extractParentsComp(1, head, LEFT, c, parents);
          // Extract parents right of the head.
          extractParentsComp(head, n, RIGHT, c, parents);
          
          return c.getScore(0, n, RIGHT, COMPLETE);
      }
docs: This gives the maximum projective dependency tree using the algorithm of
  (Eisner, 2000) as described in McDonald (2006). In the resulting tree,
  the wall node (denoted as the parent -1) will be the root, and will have
  exactly one child.
  
  @param fracRoot Input: The edge weights from the wall to each child.
  @param fracChild Input: The edge weights from parent to child.
  @param parents Output: The parent index of each node or -1 if its parent
  is the wall node.
  @return The score of the parse.