private void module_dfs_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Console.WriteLine("this is dfs module"); if (!page_dfs.IsVisible) { page_default.Visibility = Visibility.Hidden; page_input.Visibility = Visibility.Hidden; page_list.Visibility = Visibility.Hidden; page_dfs.Visibility = Visibility.Visible; page_bfs.Visibility = Visibility.Hidden; page_info.Visibility = Visibility.Hidden; HL01.Visibility = Visibility.Hidden; HL02.Visibility = Visibility.Hidden; HL03.Visibility = Visibility.Visible; HL04.Visibility = Visibility.Hidden; HL05.Visibility = Visibility.Hidden; } else if (page_dfs.IsVisible) { page_default.Visibility = Visibility.Visible; page_dfs.Visibility = Visibility.Hidden; HL03.Visibility = Visibility.Hidden; } list_subject.Visibility = Visibility.Hidden; BFS_plan.Visibility = Visibility.Hidden; Info_box.Visibility = Visibility.Hidden; rtb_input.Visibility = Visibility.Hidden; enter_button1.Visibility = Visibility.Hidden; string filename = ListSubjectViewer.filename; CoursePlan coursePlan = new CoursePlan(filename); DFS dfsResult = new DFS(coursePlan.subjects); DFS_plan.Visibility = Visibility.Visible; DFS_plan.Text = dfsResult.get_name_list(); }
public static void main() { //create a form System.Windows.Forms.Form form = new System.Windows.Forms.Form(); //create a viewer object Microsoft.Glee.GraphViewerGdi.GViewer viewer = new Microsoft.Glee.GraphViewerGdi.GViewer(); //create a graph object Microsoft.Glee.Drawing.Graph graph = new Microsoft.Glee.Drawing.Graph("graph"); //create the graph content CoursePlan coursePlan = new CoursePlan("Daftar Kuliah.txt"); coursePlan.Print(); foreach (KeyValuePair <string, Subject> entry in coursePlan.subjects) { Subject subject = entry.Value; foreach (string element in subject.preq_of) { graph.AddEdge(subject.name, element); } } DFS resultDFS = new DFS(coursePlan.subjects); resultDFS.Print(); Console.WriteLine(); BFS resultBFS = new BFS(coursePlan.subjects); resultBFS.Print(); /*string strNode1 = "Circle"; * string strNode2 = "Home"; * string strNode3 = "Diamond"; * string strNode4 = "Standard"; * * graph.AddEdge(strNode1, strNode2); * graph.AddEdge(strNode2, strNode1); * graph.AddEdge(strNode2, strNode2); * graph.AddEdge(strNode1, strNode3); * graph.AddEdge(strNode1, strNode4); * graph.AddEdge(strNode4, strNode1);*/ //graph.AddEdge(strNode2, "Node 0"); //for (int i = 0; i & lt; 3; i++) graph.AddEdge("Node " + i.ToString(), "Node " + (i + 1).ToString()); //for (int i = 0; i & lt; 3; i++) graph.AddEdge("Node " + (i + 1).ToString(), "Node " + i.ToString()); //bind the graph to the viewer viewer.Graph = graph; //associate the viewer with the form form.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; form.Controls.Add(viewer); form.ResumeLayout(); //show the form form.ShowDialog(); }