private static int PropagateNodeWeight(AST.Address node, DAG dag) { // if the node is a formula, recursively // compute its weight if (dag.isFormula(node)) { // get input nodes var vector_rngs = dag.getFormulaInputVectors(node); var scinputs = dag.getFormulaSingleCellInputs(node); var inputs = vector_rngs.SelectMany(vrng => vrng.Addresses()).ToList(); inputs.AddRange(scinputs); // call recursively and sum components var weight = 0; foreach (var input in inputs) { weight += PropagateNodeWeight(input, dag); } dag.setWeight(node, weight); return(weight); } // node is an input else { dag.setWeight(node, 1); return(1); } }
private static int PropagateNodeWeight(AST.Address node, DAG dag) { // if the node is a formula, recursively // compute its weight if (dag.isFormula(node)) { // get input nodes var vector_rngs = dag.getFormulaInputVectors(node); var scinputs = dag.getFormulaSingleCellInputs(node); var inputs = vector_rngs.SelectMany(vrng => vrng.Addresses()).ToList(); inputs.AddRange(scinputs); // call recursively and sum components var weight = 0; foreach (var input in inputs) { weight += PropagateNodeWeight(input, dag); } dag.setWeight(node, weight); return weight; } // node is an input else { dag.setWeight(node, 1); return 1; } }