public MSTAlgorithmsVis(GraphPrinter printer, Graph <VisVertex> graph, Label lblLog,
                         PictureBox dataStructuresArea, Form1 form, bool printId)
 {
     this.graph   = graph;
     visualisator = new AlgorithmsVisualisator(
         printer, graph, lblLog, dataStructuresArea, printId);
     SleepInterval = 1000;
     rnd           = new Random();
     colors        = GetColorsArray(graph.Order);
     this.form     = form;
 }
示例#2
0
 public Form1()
 {
     InitializeComponent();
     rnd = new Random();
     tBarProbability.Value = 20;
     tBarOrder.Value       = 10;
     tBarMaxWeight.Value   = 10;
     randomGraph           = new GraphGenerator();
     graph               = randomGraph.GetGraphWeight(1, 200, 200, 25, 20, true, false);
     printer             = new GraphPrinter(GraphArea, lblGraphState);
     currentVertex       = null;
     lblDescription.Text = descrPrim;
     back = new Stack <Graph <VisVertex> >(100);
     back.Push((Graph <VisVertex>)graph.Clone());
     forward    = new Stack <Graph <VisVertex> >(100);
     vertexMove = false;
 }
示例#3
0
 public AlgorithmsVisualisator(GraphPrinter printer, Graph <VisVertex> graph, Label lblLog,
                               PictureBox dataStructuresArea, bool printId) : base(printer.graphArea, printer.lblState)
 {
     this.graph              = graph;
     this.lblLog             = lblLog;
     lblLog.Text             = "Старт алгоритма.";
     edgesHighlight          = new Dictionary <Edge <VisVertex>, Color>();
     this.dataStructuresArea = dataStructuresArea;
     this.printId            = printId;
     foreach (var edge in graph.Edges)
     {
         edgesHighlight.Add(edge, printer.EdgeColor);
     }
     verticiesHighlight = new Dictionary <Vertex <VisVertex>, Color>();
     foreach (var vertex in graph.Vertices)
     {
         verticiesHighlight.Add(vertex, printer.VertexColor);
     }
 }