private void VisitNode(MyNode node) { if (node.TopologicalOrder == -2) { MyLog.DEBUG.WriteLine("TopoOrdering: cycle detected"); } //skip visited nodes if (node.TopologicalOrder != -1) { return; } //mark node as processed node.TopologicalOrder = -2; for (int i = 0; i < node.InputBranches; i++) { MyMemoryBlock <float> ai = node.GetInput(i); if (ai != null) { VisitNode(ai.Owner); } } node.TopologicalOrder = currentOrder; currentOrder++; }
private void VisitNode(MyNode node) { if (node.TopologicalOrder == -2) { MyLog.DEBUG.WriteLine("TopoOrdering: cycle detected"); } //skip visited nodes if (node.TopologicalOrder != -1) return; //mark node as processed node.TopologicalOrder = -2; for (int i = 0; i < node.InputBranches; i++) { MyMemoryBlock<float> ai = node.GetInput(i); if (ai != null) { VisitNode(ai.Owner); } } node.TopologicalOrder = currentOrder; currentOrder++; }