public void Recalculate(params string[] roots) { // Get the tails corresponding to the names ExpressionResultPair[] rootTails = this.GetRootTails(roots); // Create a dependency list based on the tails DependencyManager <ExpressionResultPair> tempDependents = _myDependencies.CloneDependents(rootTails); // Get the sources (ie: nodes with no incoming edges) since that's what the sort requires Queue <ExpressionResultPair> sources = tempDependents.GetSources(rootTails); // Do the topological sort IList <ExpressionResultPair> calcList = tempDependents.TopologicalSort(sources); NodeEventArgs args = new NodeEventArgs(); // Recalculate the sorted expressions foreach (ExpressionResultPair pair in calcList) { pair.Recalculate(); args.SetData(pair.Name, pair.ResultAsObject); if (NodeRecalculated != null) { NodeRecalculated(this, args); } } }