예제 #1
0
 public GraphFindForm()
 {
     InitializeComponent();
     FormGraphics = this.CreateGraphics();
     Graph        = new Library.Graph(this.Width, this.Height);
     ToolsWindow  = new ToolsForm();
     ToolsWindow.Show();
 }
예제 #2
0
        private Library.Graph GetGraphFromGPH()
        {
            var gph = GPH.GetGraph();

            Library.Graph gp = new Library.Graph(gph.Records.Count);
            for (long i = 0; i < gph.Records.Count; i++)
            {
                gp[i] = new Library.Vertex(name: gph.Records[(int)i].VertexName,
                                           edgesSize: gph.Records[(int)i].Edges.Count);
                for (int j = 0; j < gph.Records[(int)i].Edges.Count; j++)
                {
                    string weight  = gph.Records[(int)i].Edges[j];
                    string to      = gph.Header.Vertices[(int)j];
                    long   lweight = weight.ToLower() == "inf" ? int.MaxValue : Convert.ToInt64(weight);
                    gp[i].Edges[j] = new Library.Edge()
                    {
                        To = to, Weight = lweight
                    };
                }
            }
            return(gp);
        }