예제 #1
0
        private void btnGraph_Click(object sender, EventArgs e) //GRAPH BUTTON
        {
            //Declaring a new instance of Graph and displaying properties to the Windows Form
            Graph1 graph = new Graph1();

            richTextBox2.AppendText(graph.AccessTime + "        ");
            richTextBox2.AppendText(graph.SearchTime + "\n");
            richTextBox2.AppendText(graph.InsertTime + "        ");
            richTextBox2.AppendText(graph.DeleteTime + "\n");
            richTextBox2.AppendText(graph.SpaceComplexity + "\n");
            richTextBox2.AppendText("*All Big-O values represent worst-case scenarios unless otherwise noted");

            //Displaying the Advantages and Disadvantages of Graph to the Windows Form
            richTextBox1.AppendText("GRAPHS\n");
            richTextBox1.AppendText(graph.Advantages("A Graph is a non-linear data structure consisting of " +
                                                     "nodes and edges. Graphs are used to solve many real-life problems. Graphs are used to represent networks.  Trees are a type of graph."));
            richTextBox1.AppendText("\n\n");
            richTextBox1.AppendText(graph.Disadvantages("Types of Graph: \n" +
                                                        "Undirected Graph: nodes are connected by edges that are all bidirectional. \n" +
                                                        "Directed Graph: nodes are connected by directed edges - they only go in one direction. \n" +
                                                        "\nTypes of Graph Represntations: \n" +
                                                        "Adjacency List is an array of lists.  The size of the array is equal to the number of nodes.\n" +
                                                        "Adjacency Matrix is a 2D array of size n*n where n is the number of nodes in a graph."));

            //Displaying extra notes from a rich text file in the bin
            using (StreamReader Reader = new StreamReader(@"C:\Users\Clayt\source\repos\CSC205\CSC205_StudyProject\CSC205_StudyProject\bin\Graph.rtf"))
            {
                while (!Reader.EndOfStream)
                {
                    richTextBox5.AppendText(Reader.ReadLine());
                }
            }
        }