Пример #1
0
        private void NewGraph(int n, int m, int seed, bool isBipartite)
        {
            string str = "Graph: " + n + " " + m + " " + seed + " " + graphCounter;

            graphCounter++;

            GraphParameters gp           = new GraphParameters(n, m, seed, isBipartite);
            UGraph          uGraph       = new UGraph(gp);
            GraphDisplay    graphDisplay = new GraphDisplay(uGraph);

            /*           if (isBipartite)
             *             graphDisplay.BipartiteInit();
             *         else  */
            graphDisplay.CircleInit();

            int[] coloring = Utility.InitIntArray(n, 0);

            GraphEntry ge = new GraphEntry(gp, uGraph, graphDisplay, coloring);

            graphListBox.Items.Add(str);
            graphEntries.Add(ge);



            graphListBox.SetSelected(graphListBox.Items.Count - 1, true);
        }
Пример #2
0
 public GraphEntry(GraphParameters p, UGraph uGraph, GraphDisplay graphDisplay, int[] coloring)
 {
     Param        = p;
     UGraph       = uGraph;
     GraphDisplay = graphDisplay;
     Coloring     = coloring;
     Results      = new List <ColoringResult>();
 }
Пример #3
0
 public GraphEntry()
 {
     Param        = new GraphParameters();
     UGraph       = null;
     GraphDisplay = null;
     Coloring     = null;
     Results      = new List <ColoringResult>();
 }
Пример #4
0
        public UGraph(GraphParameters gp)
        {
            random = (gp.Seed == 0) ? new Random() : new Random(gp.Seed);

            if (gp.IsBipartite)
            {
                RandomBipartiteGraph(gp.N, gp.M);
            }
            else
            {
                RandomGraph(gp.N, gp.M);
            }
        }