示例#1
0
        private void GetComplementar_btn_Click(object sender, EventArgs e)
        {
            GNaoDirigido gc    = grafo.GetComplementar();
            string       textV = "";
            string       textA = "";

            if (gc == grafo)
            {
                MessageBox.Show("O grafo não possui complementar, pois já é completo", metodo, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                Vertice[] aux  = gc.Vertices.GeraVetor();
                Aresta[]  aux2 = gc.Arestas.GeraVetor();

                for (int i = 0; i < aux.Length; i++)
                {
                    textV += aux[i].Nome + "\n";
                }

                for (int i = 0; i < aux2.Length; i++)
                {
                    textA += aux2[i].Origem.Nome.ToString() + " - " + aux2[i].Destino.Nome.ToString() + "\n";
                }



                MessageBox.Show("O grafo complementar possui: \n" + gc.Vertices.Tamanho + " vértices " +
                                "e " + gc.Arestas.Tamanho + " arestas\n\nOs vértices são:\n" + textV + "\nAs arestas são:\n" + textA, metodo, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
示例#2
0
        private void GetAGMKruskal_btn_Click(object sender, EventArgs e)
        {
            metodo = "GETAGMPRIM ";
            DesabilitarVizualizacao();

            GNaoDirigido GRetorno = grafo;



            metodo_label.Visible = true;
        }
示例#3
0
        private void AbirArquivo_Click(object sender, EventArgs e)
        {
            OpenFileDialog biblioteca = new OpenFileDialog();

            biblioteca.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";

            if (biblioteca.ShowDialog() == DialogResult.OK)
            {
                GNaoDirigido grafo = new GNaoDirigido();
                grafo = (GNaoDirigido)grafo.GetGrafo(biblioteca.OpenFile());
                grafo.IsAdjacente(new Vertice(1), new Vertice(3));
            }
            MessageBox.Show("show");
        }
示例#4
0
        public MenuGNaoDirigido(GNaoDirigido g)
        {
            InitializeComponent();
            grafo         = g;
            StartPosition = FormStartPosition.CenterScreen;
            list_vertices_secundaria.Visible = false;

            list_vertices_secundaria.Visible   = false;
            selecione_label_secundaria.Visible = false;

            Vertice[] aux = g.Vertices.GeraVetor();

            for (int i = 0; i < aux.Length; i++)
            {
                vertices_listBox.Items.Add(aux[i].Nome.ToString());
            }
        }
示例#5
0
        public MenuGNaoDirigido(GNaoDirigido g, string endereco)
        {
            InitializeComponent();
            grafo                     = g;
            StartPosition             = FormStartPosition.CenterScreen;
            endereco_label.Text       = endereco;
            quant_arestas_label.Text  = g.Arestas.Tamanho.ToString();
            quant_vertices_label.Text = g.Vertices.Tamanho.ToString();
            tipo_grafo_label.Text     = "Não dirigido";
            geral_btn.Visible         = false;
            Vertice[] aux = g.Vertices.GeraVetor();

            for (int i = 0; i < aux.Length; i++)
            {
                vertices_listBox.Items.Add(aux[i].Nome.ToString());
                list_vertices_secundaria.Items.Add(aux[i].Nome.ToString());
            }
            list_vertices_secundaria.SelectedIndex = 0;
            vertices_listBox.SelectedIndex         = 0;
        }