コード例 #1
0
ファイル: Graph.cs プロジェクト: ss22/GraphToRegularExeptoin
 /// <summary>
 /// Initializes a new <c>DiplomProject.Graph</c> object which based on the other <c>DiplomProject.Graph</c> object.
 /// </summary>
 /// <param name="otherGraph"><c>DiplomProject.Graph</c> object.</param>
 public Graph(Graph otherGraph)
 {
     vertices = otherGraph.vertices;
     edges = otherGraph.edges;
     firstVertex = otherGraph.firstVertex;
     lastVertex = otherGraph.lastVertex;
 }
コード例 #2
0
        private void btnCreateGraph_Click(object sender, EventArgs e)
        {
            if(edges.Count == 0)
            {
                MessageBox.Show("No edges in graph! Please add edges!", "Error!");
            }
            else
            {

                int startGraphV = Convert.ToInt32(numStartGraphVertex.Value);
                int finGraphV = Convert.ToInt32(numFinishGraphVertex.Value);
                newGraph = new Graph(vertices, startGraphV, finGraphV, edges);
                this.DialogResult = DialogResult.OK;
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: ss22/GraphToRegularExeptoin
        private void button1_Click(object sender, EventArgs e)
        {
            List<Vertex> tmpVertex = new List<Vertex>();
            List<Edge> tmpEdge = new List<Edge>();

            Vertex v1 = new Vertex(1, 2);
            Vertex v2 = new Vertex(2, 3);
            Vertex v3 = new Vertex(3, 6);
            Vertex v4 = new Vertex(4, 5);
            Vertex v5 = new Vertex(5, 2);

            tmpVertex.Add(v1);
            tmpVertex.Add(v2);
            tmpVertex.Add(v3);
            tmpVertex.Add(v4);
            tmpVertex.Add(v5);

            Edge e1 = new Edge(1, 3, "0");
            Edge e2 = new Edge(1, 2, "1");
            Edge e3 = new Edge(2, 4, "0");
            Edge e4 = new Edge(3, 3, "0");
            Edge e5 = new Edge(3, 2, "1");
            Edge e6 = new Edge(3, 4, "10");
            Edge e7 = new Edge(3, 5, "11");
            Edge e8 = new Edge(4, 4, "0");
            Edge e9 = new Edge(4, 5, "1");

            tmpEdge.Add(e1);
            tmpEdge.Add(e2);
            tmpEdge.Add(e3);
            tmpEdge.Add(e4);
            tmpEdge.Add(e5);
            tmpEdge.Add(e6);
            tmpEdge.Add(e7);
            tmpEdge.Add(e8);
            tmpEdge.Add(e9);

            Graph g1 = new Graph(tmpVertex, 1, 5, tmpEdge);

            graph = new Graph(g1);

            ShowGraph();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: ss22/GraphToRegularExeptoin
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog.FileName = "";

            if(openFileDialog.ShowDialog() == DialogResult.OK)
            {
                System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(Graph));
                System.IO.StreamReader file = new System.IO.StreamReader(openFileDialog.FileName);
                graph = (Graph)reader.Deserialize(file);
                file.Close();
                if(graph != null)
                    ShowGraph();
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: ss22/GraphToRegularExeptoin
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewGraph = new CreateGraph();
            this.Visible = false;
            NewGraph.ShowDialog();

            if (NewGraph.DialogResult == DialogResult.OK)
            {
                this.Visible = true;
                graph = NewGraph.ReturnGraph();
                if (graph != null)
                    ShowGraph();
            }
            else
            {
                this.Visible = true;
            }
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: ss22/GraphToRegularExeptoin
 private void GetNewGraph(Graph newGraph)
 {
     graph = new Graph(newGraph);
 }