code: public static boolean hasOneParentPerToken(int n, VarConfig vc) {
          int[] parents = new int[n];
          Arrays.fill(parents, -2);
          for (Var v : vc.getVars()) {
              if (v instanceof LinkVar) {
                  LinkVar link = (LinkVar) v;
                  if (vc.getState(v) == LinkVar.TRUE) {
                      if (parents[link.getChild()] != -2) {
                          // Multiple parents defined for the same child.
                          return false;
                      }
                      parents[link.getChild()] = link.getParent();
                  }
              }
          }
          return !ArrayUtils.contains(parents, -2);
      }
docs: Returns whether this variable assignment specifies one parent per token.