code: static int guessNumWords(Beliefs b) {
          int n = -1;
          for (int v=0; v<b.varBeliefs.length; v++) {
              Var var = b.varBeliefs[v].getVars().get(0);
              if (var instanceof LinkVar) {
                  LinkVar link = (LinkVar) var;
                  int p = link.getParent();
                  int c = link.getChild();
                  n = Math.max(n, Math.max(p, c));
              }
          }
          return n+1;
      }
docs: Gets the maximum index of a parent or child in a LinkVar, plus one.