code: function updateStates()
      {
          var numVertices = graph.vertexCount();
          var newStates = [];
  
          // Calculate new states without changing current states
          for(var i = 0; i < numVertices; i++)
          {
              var currentVertex = graph.getVertex(topologicalSortOrder[i]);
  
              if(currentVertex.state == "NOT_READY")
              {
                  if(graph.indegree(currentVertex.id) == 0)
                  {
                      newStates.push("READY");
                  }
                  else
                  {
                      var parents = graph.getParentVertexIds(currentVertex.id);
                      var numParents = parents.length;
                      var allParentsAreSuccess = true;
                      var someParentFailed = false;
  
                      for(var j = 0; j < numParents; j++)
                      {
                          var currentParent = graph.getVertex(parents[j]);
                          allParentsAreSuccess = allParentsAreSuccess && currentParent.state == "SUCCESS";
                          someParentFailed = someParentFailed || currentParent.state == "FAIL";
                      }
  
                      if(allParentsAreSuccess)
                      {
                          newStates.push("READY");
                      }
                      else if(someParentFailed)
                      {
                          newStates.push("FAIL");
                      }
                      else
                      {
                          newStates.push("NOT_READY");
                      }
                  }
              }
              else
              {
                  newStates.push(currentVertex.state);
              }
          }
  
          // Transfer new states to the vertices
          for(var i = 0; i < numVertices; i++)
          {
              var currentVertex = graph.getVertex(topologicalSortOrder[i]);
              currentVertex.setState(newStates[i]);
          }
      }
docs: Updates all the states in the PK; follows rules specified in the MS Word/PDF docs
  
  @private