/// <summary> /// Builds list of dynamic dependencies. /// </summary> private static void VisitDependencies(Dictionary<ParameterDependency, List<ParameterDependency>> graph, HashSet<ParameterDependency> processedVertices, List<ParameterDependency> result, ParameterDependency vertex) { if (!processedVertices.Contains(vertex)) { processedVertices.Add(vertex); List<ParameterDependency> outEdges; if (graph.TryGetValue(vertex, out outEdges)) { foreach (var outVertex in outEdges) { VisitDependencies(graph, processedVertices, result, outVertex); } } // Complexity is not so good, but should be sufficient for small n. if (!result.Contains(vertex)) result.Add(vertex); } }
/// <summary> /// Builds list of dynamic dependencies. /// </summary> private static void VisitDependencies(Dictionary <ParameterDependency, List <ParameterDependency> > graph, HashSet <ParameterDependency> processedVertices, List <ParameterDependency> result, ParameterDependency vertex) { if (!processedVertices.Contains(vertex)) { processedVertices.Add(vertex); List <ParameterDependency> outEdges; if (graph.TryGetValue(vertex, out outEdges)) { foreach (var outVertex in outEdges) { VisitDependencies(graph, processedVertices, result, outVertex); } } // Complexity is not so good, but should be sufficient for small n. if (!result.Contains(vertex)) { result.Add(vertex); } } }