public static void CreateFromFile(string expr, List <Exception> exceptionsList, SortedList <string, Graph> graphsList, RichTextBox output)
        {
            try
            {
                int    startIndex  = expr.IndexOf("\"") + 1;
                int    endIndex    = expr.IndexOf("\")");
                string path        = expr.Substring(startIndex, endIndex - startIndex);
                string name        = expr.Contains(":=") ? expr.Substring(0, expr.IndexOf(":=")) : "";
                var    graphMatrix = new IntegerSquareMatrix(IntegerMatrix.GetFromFile(path));


                if (graphMatrix.Columns == 0)
                {
                    exceptionsList.Add(new FormatException("Incorrect matrix size in file"));
                }

                var graph = new Graph(graphMatrix, name);
                graphsList.Add(name, graph);
                output.Text = graph.ToString();
            }
            catch (Exception e)
            {
                exceptionsList.Add(e);
                output.Text += e.Message;
            }
        }
        private void CreateClick()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string path = dialog.FileName;


                Arithmetics.Matrix.IntegerSquareMatrix graphMatrix = (IntegerSquareMatrix)IntegerMatrix.GetFromFile(path);
                if (graphMatrix.Columns == 0)
                {
                    return;
                }
                string name = Interaction.InputBox("Введите имя графа", "", "");
                if (graphs.ContainsKey(name) == false)
                {
                    Graph NewGraph = new Graph(graphMatrix);
                    graphs.Add(name, NewGraph);
                    activeGraph       = name;
                    richTextBox1.Text = "";
                    richTextBox1.Text = graphs[activeGraph].ToString();
                    graphsToolStripMenuItem.DropDownItems.Add(name);

                    DialogResult result = MessageBox.Show("Граф " + name + " успешно добавлен");
                }
                else
                {
                    DialogResult result = MessageBox.Show("Граф c таким именем уже существует");
                }
            }
        }
 /// <summary>
 /// Аналог GetFromFile в <see cref="IntegerMatrix"/>
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static Graph GetFromFile(string path)
 {
     Arithmetics.Matrix.IntegerSquareMatrix graphMatrix = (IntegerSquareMatrix)IntegerMatrix.GetFromFile(path);
     if (graphMatrix.Columns == 0)
     {
         return(null);
     }
     return(new Graph(graphMatrix));
 }