public void dibujarGrafo()
        {
            string   cadena   = getGraphUsuarios();
            Graficar graficar = new Graficar();

            graficar.Construir(cadena, "Usuarios");
            graficar.GraficarEstructura("Usuarios.txt", "C:/EDD");
        }
        public void graficarPila()
        {
            nodoPila aux      = primero;
            Graficar graficar = new Graficar();

            aux = primero;
            string temp = "";
            string str  = "digraph { rankdir=TB;node[shape = box]; ";
            int    cont = 0;

            if (aux == null)
            {
                MessageBox.Show("Pila está vacía");
            }
            while (aux != null)
            {
                if (aux.siguiente != null)
                {
                    temp = temp + Convert.ToString(cont) + "[shape=box,label = " + Convert.ToString(aux.matriz.getValor()) + "]";
                    cont++;
                    Console.WriteLine(temp);
                    str = str + temp;
                    Console.WriteLine(" str lleva:" + str);
                }
                else
                {
                    temp = temp + Convert.ToString(cont) + "[shape=box,label = " + Convert.ToString(aux.matriz.getValor()) + "]";
                    Console.WriteLine(temp);
                    str = str + temp;
                }
                temp = "";
                aux  = aux.siguiente;
            }
            aux  = primero;
            cont = 0;
            while (aux != null)
            {
                if (aux.siguiente != null)
                {
                    str += Convert.ToString(cont) + "->";
                    cont++;
                }
                else
                {
                    str += Convert.ToString(cont);
                }
                aux = aux.siguiente;
            }

            graficar.Construir(str, "Pila");
            graficar.GraficarEstructura("Pila.txt", "C:/EDD");
        }
 public void multiplicarMatrices(NodoUsuario usuario)
 {
     try
     {
         Pila       userPila       = usuario.pila;
         Cola       userCola       = usuario.cola;
         Matriz     matrizPila     = pila.pop();
         Matriz     matrizCola     = cola.desenconlar();
         nodoMatriz nodoMatrizCola = matrizCola.raiz;
         nodoMatriz nodoMatrizPila = matrizPila.raiz;
         nodoMatriz auxCola        = nodoMatrizCola;
         nodoMatriz auxPila        = nodoMatrizPila;
         string     cadena         = "graph { node[shape= box]; {rank=same;";
         int        resultado      = 0;
         if (matrizCola.getX() == matrizPila.getY())
         {
             while (auxCola != null)
             {
                 while (nodoMatrizCola != null)
                 {
                     resultado     += (nodoMatrizCola.numero * nodoMatrizPila.numero);
                     nodoMatrizCola = nodoMatrizCola.right;
                     nodoMatrizPila = nodoMatrizPila.down;
                 }
                 Console.Write("Coordenada: " + auxPila.getX().ToString() + "," + auxCola.getY().ToString() + "; Dato: " + resultado.ToString());
                 cadena   += auxPila.getX().ToString() + auxCola.getY().ToString() + "[label = " + resultado.ToString() + "]";
                 resultado = 0;
                 auxPila   = auxPila.right;
                 if (auxPila != null)
                 {
                     nodoMatrizPila = auxPila;
                     nodoMatrizCola = auxCola;
                 }
                 else
                 {
                     auxCola        = auxCola.down;
                     nodoMatrizCola = auxCola;
                     auxPila        = matrizPila.raiz;
                     nodoMatrizPila = auxPila;
                     //CAMBIA DE FILA EN LA MATRIZ DE LA COLA Y PILA REGRESA A RAIZ
                     if (auxCola != null)
                     {
                         cadena += "}{rank=same;";
                     }
                     else
                     {
                         cadena += "}";
                     }
                 }
             }
             string aux = "";
             for (int i = 0; i < matrizCola.getY(); i++)
             {
                 for (int j = 0; j < matrizPila.getX(); j++)
                 {
                     if (i == 0)
                     {
                         if (j == matrizPila.getX() - 1)
                         {
                             aux += j.ToString() + i.ToString() + " ";
                         }
                         else
                         {
                             aux += j.ToString() + i.ToString() + "--";
                         }
                     }
                     else
                     {
                         if (j == matrizPila.getX() - 1)
                         {
                             aux += j.ToString() + i.ToString() + "--" + j.ToString() + (i - 1).ToString() + " ";
                         }
                         else
                         {
                             aux += j.ToString() + i.ToString() + "--" + j.ToString() + (i - 1).ToString() + " ";
                             aux += j.ToString() + i.ToString() + "--";
                         }
                     }
                 }
             }
             cadena += aux;
             cadena += "}";
             Graficar graficar = new Graficar();
             graficar.Construir(cadena, "Matriz");
             graficar.GraficarEstructura("Matriz.txt", "C:/EDD");
             Imagenes image = new Imagenes("Grafica de Matriz", "C:/EDD/Matriz.jpg");
             image.Show();
         }
         else
         {
             MessageBox.Show("Es imposible multiplicar entre si tales matrices" +
                             ", así que el número de columnas de la matriz A (" + matrizCola.getX().ToString() +
                             ") no equivale al número de filas de la matriz B(" + matrizPila.getY().ToString() + ")");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Error al querer operar");
     }
 }