public async void AnimateBFS(List <List <int> > order, System.Windows.Controls.Image Graph, Microsoft.Msagl.Drawing.Graph graph) { // Animation handling for (int i = 0; i < order.Count; i++) { // Delay for the animation await Task.Delay(1000); //Color node for each semester with green foreach (int j in order[i]) { graph.FindNode(ListMatKul[j].NamaMataKuliah).Attr.FillColor = Microsoft.Msagl.Drawing.Color.PaleGreen; } //Bitmap creation Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); int width = 1500; Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(bitmap); //Convert and show the image BitmapSource image = Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); Graph.Source = image; bitmap.Dispose(); } }
public static Bitmap Draw(IEnumerable <Node> nodes) { Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("MyGraph"); foreach (var node in nodes) { graph.AddNode(node.Body); foreach (var edge in node.OutEdges) { graph.AddEdge(node.Body, edge.Key, edge.To.Body); } } //graph.AddEdge("A", "B"); //graph.AddEdge("A", "B"); //graph.AddEdge("B", "C"); //graph.AddNode("He"); //graph.AddNode("He"); //graph.FindNode("A").Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red; //graph.FindNode("B").Attr.FillColor = Microsoft.Msagl.Drawing.Color.Blue; Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); int k = 150; int width = 50; Bitmap bitmap = new Bitmap(width * k, (int)(graph.Height * (width / graph.Width)) * k, PixelFormat.Format32bppPArgb); renderer.Render(bitmap); return(bitmap); }
public static void SomeClass() { var graph = new MSAGL.Drawing.Graph(""); graph.AddEdge("A", "B"); graph.AddEdge("A", "B"); graph.FindNode("A").Attr.FillColor = MSAGL.Drawing.Color.BlanchedAlmond; graph.FindNode("B").Attr.FillColor = MSAGL.Drawing.Color.BurlyWood; var renderer = new MSAGL.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); const int width = 50; int height = (int)(graph.Height * (width / graph.Width)); const PixelFormat pixfmt = System.Drawing.Imaging.PixelFormat.Format32bppPArgb; using (var bitmap = new System.Drawing.Bitmap(width, height, pixfmt)) { using (var gfx = System.Drawing.Graphics.FromImage(bitmap)) { gfx.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; gfx.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; var rect = new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height); renderer.Render(gfx, rect); bitmap.Save("test.png"); } } }
public void DrawGraph(List <List <int> > order, System.Windows.Controls.Image Graph) { Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); for (int i = 0; i < ListMatKul.Count; i++) { for (int j = 0; j < ListMatKul[i].PreRequisite.Count; j++) { graph.AddEdge(ListMatKul[i].PreRequisite[j], ListMatKul[i].NamaMataKuliah); } } //Bitmap creation Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); int width = 1500; Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(bitmap); //Convert and show the image BitmapSource image = Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); Graph.Source = image; bitmap.Dispose(); AnimateBFS(order, Graph, graph); }
public void VisualizeNeuralNetToFile(string neuralNetPicFilePath) { var fastSettings = new FastIncrementalLayoutSettings(); fastSettings.AvoidOverlaps = true; fastSettings.NodeSeparation = 30; fastSettings.RouteEdges = true; var settings = new SugiyamaLayoutSettings(); settings.FallbackLayoutSettings = fastSettings; m_opsViz.LayoutAlgorithmSettings = settings; var renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(m_opsViz); renderer.CalculateLayout(); var bitmap = new System.Drawing.Bitmap((int)m_opsViz.Width, (int)m_opsViz.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(bitmap); bitmap.Save(neuralNetPicFilePath); bitmap.Dispose(); }
public void CetakGambar() { Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer (graph); renderer.CalculateLayout(); int width = 2000; Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), PixelFormat.Format32bppPArgb); renderer.Render(bitmap); bitmap.Save("stateBFS" + state + ".png"); State++; }
public static Graph GenerateGraph(DrawItem drawItem, ref Palette palette, ref string message, string savePath = null) { try { var graph = new Graph(GetTitle(drawItem)); switch (drawItem.ViewLevel) { case ViewLevel.Activity: DrawActivity(ref graph, drawItem, ref palette); break; case ViewLevel.SubProcess: DrawTask(ref graph, drawItem, ref palette); break; } //Saves the graph to file if a file name is specified if (!string.IsNullOrEmpty(savePath)) { try { var renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); var img = new System.Drawing.Bitmap((int) graph.Width, (int) graph.Height, PixelFormat.Format32bppPArgb); renderer.Render(img); var encoderParameters = new EncoderParameters(1); encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 100L); img.Save(savePath, ImageCodecInfo.GetImageDecoders().Where(e => e.FormatID == ImageFormat.Png.Guid).First(), encoderParameters); } catch (Exception ex) { message = ex.Message; return null; } } return graph; } catch (Exception ex) { message = ex.Message; return null; } }
public void gambar() { // Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); //create the graph content /* * graph.AddEdge("A", "B"); * graph.AddEdge("B", "C"); * graph.AddEdge("A", "C").Attr.Color = Microsoft.Msagl.Drawing.Color.Green; * graph.FindNode("A").Attr.FillColor = Microsoft.Msagl.Drawing.Color.Magenta; * graph.FindNode("B").Attr.FillColor = Microsoft.Msagl.Drawing.Color.MistyRose; * Microsoft.Msagl.Drawing.Node c = graph.FindNode("C"); * c.Attr.FillColor = Microsoft.Msagl.Drawing.Color.PaleGreen; * c.Attr.Shape = Microsoft.Msagl.Drawing.Shape.Diamond; */ Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); int width = 200; Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width))); renderer.Render(bitmap); if (bitmap.Height > bitmap.Width) { bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone); } pictureBox1.Image = bitmap; //bind the graph to the viewer //viewer.Graph = graph; //associate the viewer with the form //this.SuspendLayout(); //viewer.Dock = System.Windows.Forms.DockStyle.Fill; //pictureBox1.Contains(viewer); //this.Controls.Add(viewer); //this.Controls.Add(viewer); //this.ResumeLayout(); //show the form //this.ShowDialog(); }
public static void SaveGraph(this Graph graph, long?userId, int graphWidth) { foreach (Node node in graph.Nodes) { var userInfo = (User)node.UserData; node.LabelText += $" {(userInfo.WasEdited ? "*" : "")}({userInfo.Multiplexity})"; } graph.LayoutAlgorithmSettings = new MdsLayoutSettings(); var renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); var bitmap = new Bitmap(graphWidth, (int)(graph.Height * (graphWidth / graph.Width)), PixelFormat.Format32bppPArgb); renderer.Render(bitmap); if (!Directory.Exists(ResultDir)) { Directory.CreateDirectory(ResultDir); } bitmap.Save(Path.Combine(ResultDir, $"{userId ?? 0}_graph.png")); }
public Bitmap DrawGraph() { // For DFS graph drawing Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); for (int i = 0; i < ListMatKul.Count; i++) { for (int j = 0; j < ListMatKul[i].PreRequisite.Count; j++) { graph.AddEdge(ListMatKul[i].PreRequisite[j] + '\n' + ListMatKul[GetNumberInList(ListMatKul[i].PreRequisite[j])].inTimeStamp + '/' + ListMatKul[GetNumberInList(ListMatKul[i].PreRequisite[j])].outTimeStamp, ListMatKul[i].NamaMataKuliah + '\n' + ListMatKul[i].inTimeStamp + '/' + ListMatKul[i].outTimeStamp); } } Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); int width = 1500; Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(bitmap); return(bitmap); }
public void CetakHasilDFS() /*Fungsi ini mencetak hasil akhir dari pengurutan matakuliah.*/ { Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); foreach (SimpulDFS simpul in DaftarTerurutDFS) { foreach (string tetangga in simpul.Tetangga) { graph.AddEdge("Semester " + simpul.Semester + ": " + simpul.NamaMatkul, "Semester " + SimpulDFS.KumpulanSimpul[tetangga].Semester + ": " + tetangga); } } Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer (graph); renderer.CalculateLayout(); int width = 2000; Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), PixelFormat.Format32bppPArgb); renderer.Render(bitmap); bitmap.Save("HasilDFS.png"); }
public void CetakLangkahDFS() /*Fungsi ini dipanggil untuk memasukkan simpul ke dalam tipe data graph yang disediakan oleh kakas MSAGL, lalu mencetak graph yang telah dimasuki simpul baru tersebut. Fungsi ini memperlihatkan status mulai dan selesai tiap node*/ { Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); foreach (KeyValuePair <string, SimpulDFS> pair in SimpulDFS.KumpulanSimpul) { foreach (string tetangga in SimpulDFS.KumpulanSimpul[pair.Key].Tetangga) { graph.AddEdge(pair.Key + "\n m=" + SimpulDFS.KumpulanSimpul[pair.Key].Mulai + ", s=" + SimpulDFS.KumpulanSimpul[pair.Key].Selesai, tetangga + "\n m=" + SimpulDFS.KumpulanSimpul[tetangga].Mulai + ", s=" + SimpulDFS.KumpulanSimpul[tetangga].Selesai); } } Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer (graph); renderer.CalculateLayout(); int width = 2000; Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), PixelFormat.Format32bppPArgb); renderer.Render(bitmap); bitmap.Save("stateDFS" + SimpulDFS.waktu + ".png"); }
private void MakeGraph(string filename, bool isExploreGraph) { // Membuat Objek Graph Graph graph = new Graph("graph"); if (!isExploreGraph) { // Create Graph Content for (int i = 1; i < lines.Length; i++) { string[] splitLine = lines[i].ToString().Split(' '); string source = splitLine[0]; string dest = splitLine[1]; // Styling Graph var edge = graph.AddEdge(source, dest); edge.Attr.ArrowheadAtSource = ArrowStyle.None; edge.Attr.ArrowheadAtTarget = ArrowStyle.None; Node src = graph.FindNode(source); Node target = graph.FindNode(dest); src.Attr.Shape = Shape.Circle; target.Attr.Shape = Shape.Circle; src.Attr.FillColor = Microsoft.Msagl.Drawing.Color.PeachPuff; target.Attr.FillColor = Microsoft.Msagl.Drawing.Color.PeachPuff; src.Attr.Color = Microsoft.Msagl.Drawing.Color.Purple; target.Attr.Color = Microsoft.Msagl.Drawing.Color.Purple; edge.Attr.Color = Microsoft.Msagl.Drawing.Color.GhostWhite; edge.Attr.Weight = 700; // Menambah akun unik ke uniqueAccounts uniqueAccounts.Add(source); uniqueAccounts.Add(dest); } // Create Graph Image Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); graph.Attr.BackgroundColor = Microsoft.Msagl.Drawing.Color.Transparent; int height = 500; if (graph.Width > graph.Height && graph.Width > 400) { height = 200; } else if (graph.Width / graph.Height > 1.3) { height = 150; } else if (graph.Width / graph.Height > 1.5) { height = 120; } else if (graph.Width * (height / graph.Height) > 500) { height = 300; } graphBitmap = new Bitmap((int)(graph.Width * (height / graph.Height)), height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(graphBitmap); Bitmap cloneBitmap = (Bitmap)graphBitmap.Clone(); string outputFileName = "graph-" + filename + ".png"; // string outputFileName = "graph.png"; cloneBitmap.Save(outputFileName); cloneBitmap.Dispose(); } else { // Create Graph Content for (int i = 1; i < lines.Length; i++) { string[] splitLine = lines[i].ToString().Split(' '); string source = splitLine[0]; string dest = splitLine[1]; // Styling Graph var edge = graph.AddEdge(source, dest); edge.Attr.ArrowheadAtSource = ArrowStyle.None; edge.Attr.ArrowheadAtTarget = ArrowStyle.None; Node src = graph.FindNode(source); Node target = graph.FindNode(dest); src.Attr.Shape = Shape.Circle; target.Attr.Shape = Shape.Circle; if (exploreRoute.Contains(source)) { src.Attr.FillColor = Microsoft.Msagl.Drawing.Color.LightPink; src.Attr.Color = Microsoft.Msagl.Drawing.Color.Purple; } else { src.Attr.FillColor = Microsoft.Msagl.Drawing.Color.PeachPuff; src.Attr.Color = Microsoft.Msagl.Drawing.Color.Purple; } if (exploreRoute.Contains(dest)) { target.Attr.FillColor = Microsoft.Msagl.Drawing.Color.LightPink; target.Attr.Color = Microsoft.Msagl.Drawing.Color.Purple; } else { target.Attr.FillColor = Microsoft.Msagl.Drawing.Color.PeachPuff; target.Attr.Color = Microsoft.Msagl.Drawing.Color.Purple; } if (exploreRoute.Contains(source) && exploreRoute.Contains(dest)) { edge.Attr.Color = Microsoft.Msagl.Drawing.Color.Red; } else { edge.Attr.Color = Microsoft.Msagl.Drawing.Color.LightPink; } } // Create Graph Image Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); graph.Attr.BackgroundColor = Microsoft.Msagl.Drawing.Color.Transparent; int height = 350; if (graph.Width > graph.Height && graph.Width * (height / graph.Height) > 300) { height = 160; } else if (graph.Width / graph.Height > 1.3) { height = 75; } else if (graph.Width / graph.Height > 1.5) { height = 100; } else if (graph.Width * (height / graph.Height) > 500) { height = 200; } graphBitmap = new Bitmap((int)(graph.Width * (height / graph.Height)), height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(graphBitmap); Bitmap cloneBitmap = (Bitmap)graphBitmap.Clone(); string outputFileName = "explore-" + filename + ".png"; // string outputFileName = "graph.png"; cloneBitmap.Save(outputFileName); cloneBitmap.Dispose(); } }
//Button untuk susun kuliah private void Button_Click_1(object sender, RoutedEventArgs e) { // Inisialisasi map kuliah Dictionary <string, List <string> > mapKuliah = new Dictionary <string, List <string> >(); Dictionary <string, Course> courses = new Dictionary <string, Course>(); // Cek file sudah didapat atau belum if (result == true) { //Jika file sudah didapat, baca. using (StreamReader sr = new StreamReader(TextBox1.Text)) { string kodeKuliah = string.Empty; while ((kodeKuliah = sr.ReadLine()) != null) { string kodeKuliahMasukan = string.Empty; string kodeKuliahDitunjuk = string.Empty; bool sudahDapatAwal = false; for (int i = 0; i < kodeKuliah.Length; ++i) { if (!sudahDapatAwal) { if (kodeKuliah[i] == ',' || kodeKuliah[i] == '.') { kodeKuliahDitunjuk = Regex.Replace(kodeKuliahMasukan, @"\s+", String.Empty); courses[kodeKuliahDitunjuk] = new Course(kodeKuliahDitunjuk); kodeKuliahMasukan = string.Empty; sudahDapatAwal = true; } else { kodeKuliahMasukan += kodeKuliah[i]; } } else { if (kodeKuliah[i] == ',' || kodeKuliah[i] == '.') { kodeKuliahMasukan = Regex.Replace(kodeKuliahMasukan, @"\s+", String.Empty); courses[kodeKuliahDitunjuk].AddPrerequisite(kodeKuliahMasukan); if (mapKuliah.ContainsKey(kodeKuliahDitunjuk)) { mapKuliah[kodeKuliahDitunjuk].Add(kodeKuliahMasukan); } else { mapKuliah.Add(kodeKuliahDitunjuk, new List <string> { kodeKuliahMasukan }); } kodeKuliahMasukan = string.Empty; } else { kodeKuliahMasukan += kodeKuliah[i]; } } } } } //Graph untuk digambar. Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph(""); foreach (KeyValuePair <string, List <string> > entry in mapKuliah) { for (int i = 0; i < entry.Value.Count; ++i) { graph.AddEdge(entry.Value[i], entry.Key); } } Microsoft.Msagl.GraphViewerGdi.GraphRenderer renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); int width = 250; Bitmap bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(bitmap); //Masukan gambar graph awal ke dalam list gambar listGambar.Add(BitmapToImageSource(bitmap)); //Tampilkan gambar pertama ImageBox1.Source = listGambar[counterGambarTampil]; TopologicalSort topo = new TopologicalSort(courses); // Mengecek pilihan radio button (DFS / BFS) if (rdBtnDFS.IsChecked == true) // Saat DFS dipilih { // Generate solusi menggunakan topological sort DFS List <Tuple <string, int, int> > dfs = topo.GenerateSolutionDFS(); // Membuat step-by-step pemrosesan graph foreach (Tuple <string, int, int> entry in dfs) { if (entry.Item3 == -1) // Saat node yang dikunjungi baru masuk/start { // Set warna node yang baru dikunjungi dengan warna merah serta membarikan timestamp start graph.FindNode(entry.Item1).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red; graph.FindNode(entry.Item1).LabelText = graph.FindNode(entry.Item1).LabelText + " " + entry.Item2 + "/"; } else // Saat node yang dikunjungi sudah selesai / finish { // Set warna node yang selesai dikunjungi dengan warna biru serta membarikan timestamp start dan finish graph.FindNode(entry.Item1).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Blue; graph.FindNode(entry.Item1).LabelText = graph.FindNode(entry.Item1).LabelText + entry.Item3; } // Membuat renderer untuk graph renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); width = 250; bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(bitmap); // Memasukan rendered graph ke list graph untuk keperluan visualisasi step-by-step listGambar.Add(BitmapToImageSource(bitmap)); } // Generate pesan untuk visualisasi informasi matakuliah yang diambil per semester int counterSemester = 0; int maxSemester = 0; // Mencari semester maksimum pada seluruh mata kuliah foreach (var x in courses) { if (x.Value.semester > maxSemester) { maxSemester = x.Value.semester; } } // Membuat dan mengisi list matakuliah berdasarkan semester List <List <string> > semesterList = new List <List <string> >(); for (int i = 0; i < maxSemester; i++) { semesterList.Add(new List <string>()); } foreach (var x in courses) { semesterList[x.Value.semester - 1].Add(x.Key); } // Generate string informasi matakuliah per semester foreach (var x in semesterList) { counterSemester++; PesanSemester += "Semester " + counterSemester + ": "; for (int i = 0; i < x.Count; ++i) { PesanSemester += x[i]; if (i != x.Count - 1) { PesanSemester += ", "; } } PesanSemester += " \n"; } } else if (rdBtnBFS.IsChecked == true) // Saat BFS dipilih { // Generate solusi menggunakan pendekatan topological sort BFS List <List <string> > bfs = topo.GenerateSolutionBFS(); // Membuat visualisasi graph secara step-by-step foreach (var x in bfs) { // Mewarnai node yang sudah dipilih dengan warna biru foreach (var entry in x) { graph.FindNode(entry).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Blue; } // Membuat renderer untuk graph renderer = new Microsoft.Msagl.GraphViewerGdi.GraphRenderer(graph); renderer.CalculateLayout(); width = 250; bitmap = new Bitmap(width, (int)(graph.Height * (width / graph.Width)), System.Drawing.Imaging.PixelFormat.Format32bppPArgb); renderer.Render(bitmap); // Memasukan gambar ke dalam list gambar listGambar.Add(BitmapToImageSource(bitmap)); } // Generate string berisi informasi matakuliah yang diambil tiap semester int counterSemester = 0; foreach (var x in bfs) { counterSemester++; PesanSemester += "Semester " + counterSemester + ": "; for (int i = 0; i < x.Count; ++i) { PesanSemester += x[i]; if (i != x.Count - 1) { PesanSemester += ", "; } } PesanSemester += " \n"; } } else { // Jika tipe sort belum dipilih munculkan pesan error. System.Windows.MessageBox.Show("Please choose one type of topological sort (DFS/BFS)."); } } else { // Jika file belum didapat munculkan pesan error. System.Windows.MessageBox.Show("Please enter the input file."); } }