コード例 #1
0
        public void Agrandar()
        {
            TablaHash t = new TablaHash(Tabla.Length * 2);

            for (int i = 0; i < Tabla.Length; i++)
            {
                if (Tabla[i] != null)
                {
                    t.Insertar(Tabla[i].Usuario);
                }
            }
            Tabla    = t.Tabla;
            Densidad = t.Densidad;
        }
コード例 #2
0
        public Byte[] tablaGrafo()
        {
            tabla = new TablaHash(43);
            ingresarTabla(arbol.Raiz);

            dot = "digraph TablaHash{\n graph[rankdir=\"LR\"];\n tabla[label=\"";
            NodoArbol n;

            for (int i = 0; i < tabla.Tabla.Length; i++)
            {
                if (tabla.Tabla[i] != null)
                {
                    n   = tabla.Tabla[i].Usuario;
                    dot = dot + "Nick: " + n.NickName + "  --  Password: "******"  --  Correo: " + n.Correo + "  --  Conexion: " + n.Conexion.ToString() + " | \n";
                }
            }
            dot = dot + "\"\n shape=\"record\"];\n }";

            TextWriter t = new StreamWriter(@"C:\GrafosEDD\grafoTabla.dot");

            t.WriteLine(dot);
            t.Close();

            Byte[] a = new Byte[0];

            String comando       = "\"C:/Program Files (x86)/Graphviz2.38/bin/dot.exe\" -Tpng C:\\GrafosEDD\\grafoTabla.dot -o C:\\GrafosEDD\\grafoTabla.png";
            var    procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe", "/c" + comando);
            var    proc          = new System.Diagnostics.Process {
                StartInfo = procStartInfo
            };

            proc.Start();
            proc.WaitForExit();

            FileStream foto = new FileStream("C:\\GrafosEDD\\grafoTabla.png", FileMode.OpenOrCreate, FileAccess.ReadWrite);

            a = new Byte[foto.Length];
            BinaryReader reader = new BinaryReader(foto);

            a = reader.ReadBytes(Convert.ToInt32(foto.Length));
            foto.Close();

            return(a);
        }