private static void AddReferencesRecursive(AssemblyGraph graph, AssemblyViewModel assembly) { assembly.IsProcessed = true; foreach (var refAssembly in assembly.ReferencedAssemblies) { if (!graph.ContainsVertex(refAssembly)) { graph.AddVertex(refAssembly); } var edge = new Edge <AssemblyViewModel>(assembly, refAssembly); Edge <AssemblyViewModel> reverseEdge; var result = graph.TryGetEdge(refAssembly, assembly, out reverseEdge); if (result) { reverseEdge.IsTwoWay = true; edge.IsTwoWay = true; } graph.AddEdge(edge); if (!refAssembly.IsProcessed) { AddReferencesRecursive(graph, refAssembly); } } }
private static AssemblyGraph CreateGraph(IEnumerable <AssemblyViewModel> assemblies) { var graph = new AssemblyGraph(true); foreach (var assembly in assemblies) { if (!graph.ContainsVertex(assembly)) { graph.AddVertex(assembly); } AddReferencesRecursive(graph, assembly); } AssemblyViewModel.ClearCache(); return(graph); }