Пример #1
0
        public void PrintDataStructuresBoruvka(
            AdjVertexSortedList[] lists, IValiableDSU dsu, Color[] colors, int size = 20)
        {
            bitmap   = new Bitmap(dataStructuresArea.Width, dataStructuresArea.Height);
            graphics = Graphics.FromImage(bitmap);
            graphics.Clear(areaBackColor);
            Point leftBorder = new Point(3, 3);
            float nameSize   = graphics.MeasureString("DSU", smallFont).Height;

            graphics.DrawString("DSU", smallFont, textBrush, leftBorder);
            leftBorder.Offset(0, (int)nameSize + 3);
            List <TreePointsDSU> dsuTrees = TreePointsDSU.GetTrees(dsu, leftBorder, size, 3);

            PrintDSU(dsuTrees, size, colors);
            leftBorder.Offset(0, TreePointsDSU.GetMaxLevel(dsuTrees) * (size + 3) + 3);
            nameSize = graphics.MeasureString(
                "Сортированные списки смежности компонент:", smallFont).Height;
            graphics.DrawString(
                "Сортированные списки смежности компонент:", smallFont, textBrush, leftBorder);
            leftBorder.Offset(0, (int)nameSize + 3);
            for (int i = 0; i < lists.Length; i++)
            {
                if (lists[i] == null)
                {
                    break;
                }
                if (lists[i].IsEmpty)
                {
                    continue;
                }
                PrintASL(lists[i], i.ToString(), leftBorder, size);
                leftBorder.Offset(0, size + 3);
            }
            dataStructuresArea.Image = bitmap;
        }
Пример #2
0
        public void PrintDataStructuresKruskal(Edge <VisVertex>[] list, Edge <VisVertex> currentEdge,
                                               IValiableDSU dsu, Color[] colors, int size = 20)
        {
            bitmap   = new Bitmap(dataStructuresArea.Width, dataStructuresArea.Height);
            graphics = Graphics.FromImage(bitmap);
            graphics.Clear(areaBackColor);
            Point leftBorder = PrintSortedEdgeList(list, currentEdge, new Point(3, 3), 20, 400);
            float nameSize   = graphics.MeasureString("DSU", smallFont).Height;

            graphics.DrawString("DSU", smallFont, textBrush, leftBorder);
            leftBorder.Offset(0, (int)nameSize + 3);
            List <TreePointsDSU> dsuTrees = TreePointsDSU.GetTrees(dsu, leftBorder, size, 3);

            PrintDSU(dsuTrees, size, colors);
            dataStructuresArea.Image = bitmap;
        }