private void ShowMPF() { if (g == null) { ShowError("Сначала создайте граф"); return; } if (g.isOrGraph == false) { ShowError("Нужен орграф"); return; } ClearDrawArgs(); string mpf = ""; levels.Clear(); try { Algorythms.MakeMPF(g.Matrix, ref mpf, ref levels); } catch (ArgumentException) { ShowError("Привести данный граф к ярусно-параллельной форме невозможно, так как он имеет цикл"); } richTextBox3.Text = mpf; drawLewels = true; Action1(); }
private void Deicstr() { path.Clear(); if (g == null) { ShowError("Сначала создайте граф"); return; } List <List <int> > paths = new List <List <int> >(); List <int> pathsLengths = new List <int>(); Algorythms.Deicstr(g, (int)numericUpDown2.Value, paths, pathsLengths); paThs1 = paths; listBox2.Items.Clear(); for (int i = 0; i < pathsLengths.Count; i++) { string str = "Путь " + (int)numericUpDown2.Value + "->" + (i + 1) + " = "; if (pathsLengths[i] != 10000) { str += pathsLengths[i].ToString(); } else { str += "Нет пути"; } listBox2.Items.Add(str); } drawPath = true; Action1(); }
private void Cores() { if (g == null) { ShowError("Сначала создайте граф"); return; } if (g.isOrGraph == false) { ShowError("Нужен орграф"); return; } cores.Clear(); cores = Algorythms.Cores(g.Matrix); drawCores = true; ShowCoresInfo(); Action1(); }
private void ShowComponents() { if (g == null) { ShowError("Сначала создайте граф"); return; } if (g.isOrGraph == true) { ShowError("Нужен неорграф"); return; } cores.Clear(); Algorythms.FindConnectivityComponents(g, cores); drawCores = true; ShowComponentsInfo(); Action1(); }
private void Clique() { if (g == null) { ShowError("Сначала создайте граф"); return; } if (g.isOrGraph == true) { ShowError("Нужен неорграф"); return; } ClearDrawArgs(); List <string> textRes = new List <string>(); cores.Clear(); Algorythms.Clique(g, cores, textRes); drawCores = true; ShowCliqueInfo(textRes); Action1(); }
private void Prim() { edges.Clear(); if (g == null) { ShowError("Сначала создайте граф"); return; } if (g.isOrGraph) { ShowError("Cоздайте неориентированный граф"); return; } try { edges = Algorythms.Prim(g.Matrix); ShowPrimInfo(); drawEdges = true; Action1(); } catch (Exception) { ShowError("Невозможно построить остов. Не все вершины соединены"); } }