public void ShowSomeGraphs()
        {
            var factory = BuildTestCaseFactory(1).WithDeferralBudgetOf(12);

            const int maximumStrengthRequired = 2;

            factory.ExecuteParameterisedUnitTestForAllTestCases(maximumStrengthRequired, testCase =>
            {
                var graph = testCase.MakeGraph();
                if (!graph.IsDirected)
                {
                    throw new LogicErrorException(
                        "One of the aims of this example is to show the guaranteed generation of a DAG via a filter: it has failed.");
                }

                Console.WriteLine("**********");

                foreach (var vertex in graph.TopologicalSort())
                {
                    var outEdges = graph.OutEdges(vertex).ToList();
                    Console.WriteLine(outEdges.Any()
                        ? String.Format("Source vertex: {0}, leading to targets: {1}", vertex.Id,
                            outEdges.Select(edge => edge.GetOtherVertex(vertex).Id.ToString())
                                .Aggregate((lhs, rhs) => String.Format("{0}, {1}", lhs, rhs)))
                        : String.Format("Isolated vertex: {0}", vertex.Id));
                }

                var windowToPopUp = new GraphDisplayWindow {DataContext = graph};
                windowToPopUp.ShowDialog();
            });
        }
예제 #2
0
        private void generate_graph_button_Click(object sender, RoutedEventArgs e)
        {
            GraphDisplayWindow gdw = new GraphDisplayWindow(perfItem);

            gdw.Show();
        }