Esempio n. 1
0
        // build th egraph, adding the edge (a, b) if b is dependent on a.
        // assume a pair is listed on builder.
        private static GraphBuild BuildGraph(string[] projects, string[][] dependencies)
        {
            GraphBuild graph = new GraphBuild();

            foreach (var project in projects)
            {
                graph.GetOrCreateNode(project);
            }

            foreach (string[] dependency in dependencies)
            {
                string first  = dependency[0];
                string second = dependency[1];
                graph.AddEdge(first, second);
            }

            return(graph);
        }
Esempio n. 2
0
        // solution #1
        public static Project[] FindBuildOrder(string[] projects, string[][] dependencies)
        {
            GraphBuild graph = BuildGraph(projects, dependencies);

            return(OrderProjects(graph.GetNodes()));
        }