Grafo de Zeggelink: Estructuras sociales de la amistad PROGRAM GrafoZeggelink; { ****************************************************************************** El modelo, descrito por Zeggelink (1995) como uns estructura de red social, analiza las relaciones de amistad que se pueden presentar en grupos pequeños. El programa crea una poblacion de individuos (o agentes) y recrea la evolucion dinamica de una red de amistades. Aplica reglas de comportamiento simples y analíticas que tienden a minimizar una funcion de tension, induciendo a cada individuo a satisfacer una restriccion en cuanto al numero preferencial de amigos que puede tener [ NumAmiPref = 2 ]. Las relaciones se dan a traves de tres tipos de mecanismos de comunicacion: (i) mensaje negativo, (ii) eleccion positiva, y (iii) eleccion positiva reciproca. La aplicacion permite visualizar simultaneamente la estructura y la matriz de adyacencias del grafo. Numero de individuos [ N ] : 5 Numero de relaciones posibles [ N(N - 1) ] : 20 Version 1.0.0 Numero de lineas: 508. ****************************************************************************** } USES CRT, Graph, SYSUTILS; CONST N = 5; { Conjunto de N individuos : A = [ ai/i=1, ... N ] } { Coordenadas de objetos } x1 = 260; y1 = 90; { Individuo 1 } x2 = 500; y2 = 180; { Individuo 2 } x3 = 50; y3 = 200; { Individuo 3 } x4 = 450; y4 = 350; { Individuo 4 } x5 = 100; y5 = 370; { Individuo 5 } { Coordenadas de relaciones } x12 = 477; y12 = 173; { Vinculos individuo 1 } x13 = 70; y13 = 190; x14 = 435; y14 = 330; x15 = 114; y15 = 351; x21 = 282; y21 = 100; { Vinculos individuo 2 } x23 = 75; y23 = 200; x24 = 457; y24 = 327; x25 = 122; y25 = 362; x31 = 240; y31 = 100; { Vinculos individuo 3 } x32 = 477; y32 = 182; x34 = 428; y34 = 342; x35 = 94; y35 = 347; x41 = 273; y41 = 109; { Vinculos individuo 4 } x42 = 496; y42 = 202; x43 = 70; y43 = 210; x45 = 125; y45 = 370; x51 = 251; y51 = 111; { Vinculos individuo 5 } x52 = 478; y52 = 192; x53 = 58; y53 = 222; x54 = 426; y54 = 352; TYPE Matriz = array [ 1..N, 1..N ] of smallint; Vector = array [ 1..N ] of smallint; VAR GD, GM, i, j, t, EntradaUsuario : smallint; Generacion : shortstring; MatrizAdy, MatrizAdyAlm : Matriz; { Matriz de adyacencias y configuracion almacenada en memoria, respectivamente } FuncionTensor : vector; FUNCTION EnteroAleatorio( m, n : integer ) : integer; { Toma dos enteros m y n, genera un entero aleatoriamente seleccionado de m, m+1, ..., m + n - 1. y devuelve un entero aleatorio. Utiliza la funcion Random que genera un numero real aleatorio en el intervalo del 0 - 1 } BEGIN EnteroAleatorio := m + trunc( n * Random ); END {EnteroAleatorio}; FUNCTION ValorAbsoluto( m, n : integer ) : real; BEGIN ValorAbsoluto := sqrt(sqr( m - n )) END; PROCEDURE DibujarIndividuos; BEGIN { Objetos } setcolor( white ); circle( x1, y1, 20 ); { Individuo 1 } circle( x2, y2, 20 ); { Individuo 2 } circle( x3, y3, 20 ); { Individuo 3 } circle( x4, y4, 20 ); { Individuo 4 } circle( x5, y5, 20 ); { Individuo 5 } END; PROCEDURE EleccionPositiva( i, j : integer ); BEGIN setcolor( white ); circle( i, j, 5 ); END; PROCEDURE MensajeNegativo( i, j : integer ); BEGIN setcolor( green ); circle( i, j, 5 ); END; PROCEDURE VinculoPosible( i, j : integer ); BEGIN setcolor( red ); circle( i, j, 5 ); END; PROCEDURE ActualizarVinculos; BEGIN If MatrizAdy[ 2, 1 ] = 1 then EleccionPositiva( x12, y12 ) Else If MatrizAdy[ 2, 1 ] = -1 then MensajeNegativo( x12, y12 ) Else VinculoPosible( x12, y12 ); Line( x1, y1, x2, y2 ); { Vinculo 1 - 2 }; If MatrizAdy[ 3, 1 ] = 1 then EleccionPositiva( x13, y13 ) Else If MatrizAdy[ 3, 1 ] = -1 then MensajeNegativo( x13, y13 ) Else VinculoPosible( x13, y13 ); Line( x1, y1, x3, y3 ); { Vinculo 1 - 3 }; If MatrizAdy[ 4, 1 ] = 1 then EleccionPositiva( x14, y14 ) Else If MatrizAdy[ 4, 1 ] = -1 then MensajeNegativo( x14, y14 ) Else VinculoPosible( x14, y14 ); Line( x1, y1, x4, y4 ); { Vinculo 1 - 4 }; If MatrizAdy[ 5, 1 ] = 1 then EleccionPositiva( x15, y15 ) Else If MatrizAdy[ 5, 1 ] = -1 then MensajeNegativo( x15, y15 ) Else VinculoPosible( x15, y15 ); Line( x1, y1, x5, y5 ); { Vinculo 1 - 5 }; If MatrizAdy[ 1, 2 ] = 1 then EleccionPositiva( x21, y21 ) Else If MatrizAdy[ 1, 2 ] = -1 then MensajeNegativo( x21, y21 ) Else VinculoPosible( x21, y21 ); Line( x2, y2+3, x1, y1+3 ); { Vinculo 2 - 1 }; If MatrizAdy[ 3, 2 ] = 1 then EleccionPositiva( x23, y23 ) Else If MatrizAdy[ 3, 2 ] = -1 then MensajeNegativo( x23, y23 ) Else VinculoPosible( x23, y23 ); Line( x2, y2, x3, y3 ); { Vinculo 2 - 3 }; If MatrizAdy[ 4, 2 ] = 1 then EleccionPositiva( x24, y24 ) Else If MatrizAdy[ 4, 2 ] = -1 then MensajeNegativo( x24, y24 ) Else VinculoPosible( x24, y24 ); Line( x2, y2, x4, y4 ); { Vinculo 2 - 4 }; If MatrizAdy[ 5, 2 ] = 1 then EleccionPositiva( x25, y25 ) Else If MatrizAdy[ 5, 2 ] = -1 then MensajeNegativo( x25, y25 ) Else VinculoPosible( x25, y25 ); Line( x2, y2, x5, y5 ); { Vinculo 2 - 5 }; If MatrizAdy[ 1, 3 ] = 1 then EleccionPositiva( x31, y31 ) Else If MatrizAdy[ 1, 3 ] = -1 then MensajeNegativo( x31, y31 ) Else VinculoPosible( x31, y31 ); Line( x3, y3+3, x1, y1+3 ); { Vinculo 3 - 1 }; If MatrizAdy[ 2, 3 ] = 1 then EleccionPositiva( x32, y32 ) Else If MatrizAdy[ 2, 3 ] = -1 then MensajeNegativo( x32, y32 ) Else VinculoPosible( x32, y32 ); Line( x3, y3+3, x2, y2+3 ); { Vinculo 3 - 2 }; If MatrizAdy[ 4, 3 ] = 1 then EleccionPositiva( x34, y34 ) Else If MatrizAdy[ 4, 3 ] = -1 then MensajeNegativo( x34, y34 ) Else VinculoPosible( x34, y34 ); Line( x3, y3, x4, y4 ); { Vinculo 3 - 4 }; If MatrizAdy[ 5, 3 ] = 1 then EleccionPositiva( x35, y35 ) Else If MatrizAdy[ 5, 3 ] = -1 then MensajeNegativo( x35, y35 ) Else VinculoPosible( x35, y35 ); Line( x3, y3, x5, y5 ); { Vinculo 3 - 5 }; If MatrizAdy[ 1, 4 ] = 1 then EleccionPositiva( x41, y41 ) Else If MatrizAdy[ 1, 4 ] = -1 then MensajeNegativo( x41, y41 ) Else VinculoPosible( x41, y41 ); Line( x4, y4+3, x1, y1+3 ); { Vinculo 4 - 1 }; If MatrizAdy[ 2, 4 ] = 1 then EleccionPositiva( x42, y42 ) Else If MatrizAdy[ 2, 4 ] = -1 then MensajeNegativo( x42, y42 ) Else VinculoPosible( x42, y42 ); Line( x4+3, y4, x2+3, y2 ); { Vinculo 4 - 2 }; If MatrizAdy[ 3, 4 ] = 1 then EleccionPositiva( x43, y43 ) Else If MatrizAdy[ 3, 4 ] = -1 then MensajeNegativo( x43, y43 ) Else VinculoPosible( x43, y43 ); Line( x4, y4+3, x3, y3+3 ); { Vinculo 4 - 3 }; If MatrizAdy[ 5, 4 ] = 1 then EleccionPositiva( x45, y45 ) Else If MatrizAdy[ 5, 4 ] = -1 then MensajeNegativo( x45, y45 ) Else VinculoPosible( x45, y45 ); Line( x4, y4, x5, y5 ); { Vinculo 4 - 5 }; If MatrizAdy[ 1, 5 ] = 1 then EleccionPositiva( x51, y51 ) Else If MatrizAdy[ 1, 5 ] = -1 then MensajeNegativo( x51, y51 ) Else VinculoPosible( x51, y51 ); Line( x5+3, y5, x1+3, y1 ); { Vinculo 5 - 1 }; If MatrizAdy[ 2, 5 ] = 1 then EleccionPositiva( x52, y52 ) Else If MatrizAdy[ 2, 5 ] = -1 then MensajeNegativo( x52, y52 ) Else VinculoPosible( x52, y52 ); Line( x5, y5+3, x2, y2+3 ); { Vinculo 5 - 2 }; If MatrizAdy[ 3, 5 ] = 1 then EleccionPositiva( x53, y53 ) Else If MatrizAdy[ 3, 5 ] = -1 then MensajeNegativo( x53, y53 ) Else VinculoPosible( x53, y53 ); Line( x5+3, y5, x3+3, y3 ); { Vinculo 5 - 3 }; If MatrizAdy[ 4, 5 ] = 1 then EleccionPositiva( x54, y54 ) Else If MatrizAdy[ 4, 5 ] = -1 then MensajeNegativo( x54, y54 ) Else VinculoPosible( x54, y54 ); Line( x5, y5+3, x4, y4+3 ); { Vinculo 5 - 4 }; END; PROCEDURE MatrizNula; BEGIN for i := 1 to N do for j := 1 to N do MatrizAdy[ j, i ] := 0; END; PROCEDURE MostrarGeneracion; BEGIN writeln; writeln( ' Generacion numero [ ', t, ' ]' ); Outtextxy( 100, 460, 'Generacion numero' ); Generacion := IntToStr( t ); Outtextxy( 250, 460, Generacion ) END; PROCEDURE CapturaDeDatos; BEGIN writeln( 'Ingrese fila a fila los valores iniciales para la tabla de adyacencias' ); for i := 1 to N do for j := 1 to N do readln( MatrizAdy[ j, i ] ); t := t+1; MostrarGeneracion END; PROCEDURE MatrizUnitaria; BEGIN for i:= 1 to N do for j := 1 to N do MatrizAdy[ j, i ] := 1; t := t+1; MostrarGeneracion END; PROCEDURE AsignarAleatorio; BEGIN Randomize; for i := 1 to N do for j := 1 to N do BEGIN MatrizAdy[ j, i ] := EnteroAleatorio( 0, 3 ); If MatrizAdy[ j, i ] > 1 then MatrizAdy[ j, i ] := -1 END; t := t+1; MostrarGeneracion END; PROCEDURE ModificarMatriz; VAR FilElemInic, ColElemInic, { Fila y columna del elemento inicial } FilElemFin, ColElemFin : integer; { Fila y columna del ultimo elemento } BEGIN writeln; writeln( 'Ingrese secuencialmente la FILA y la COLUMNA del primer elemento a modificar':5 ); writeln ( 'Elemento inicial: ':10 ); read ( FilElemInic, ColElemInic ); writeln( 'Ingrese del mismo modo FILA y la COLUMNA del ultimo elemento a modificar':5); writeln( 'Elemento final: ':10 ); read ( FilElemFin, ColElemFin ); writeln; writeln( 'Comience a digitar fila a fila un valor entero [0..1] para cada uno ':5 ); writeln( ' de los elementos del intervalo [Elemento inicial..Elemento final]: ' ); for j := FilElemInic to FilElemFin do for i := ColElemInic to ColElemFin do read( MatrizAdy[ i, j ] ); t := t+1; MostrarGeneracion END; PROCEDURE AlmacenarEstado; BEGIN writeln; writeln( '--Guardar la configuracion actual de la matriz de adyacencias : 1 ':10 ); writeln( '--Recuperar la ultima matriz almacenada : 2 ':10 ); read( EntradaUsuario ); If EntradaUsuario = 1 then BEGIN { Almacenamiento de la configuracion actual } for i := 1 to N do for j := 1 to N do MatrizAdyAlm[ i, j ] := MatrizAdy[ i, j ]; END Else BEGIN { Recuperacion del ultimo estado-vecindad almacenado } for i := 1 to N do for j := 1 to N do MatrizAdy[ i, j ] := MatrizAdyAlm[ i, j ]; END END; PROCEDURE DibujarMatrizAdyacencias; BEGIN { Visualizacion de la matriz de adyacencias en la aplicacion grafica } for i := 1 to N do for j:= 1 to N do If i = j then MatrizAdy[ i, j ] := 0; for i := 1 to N do for j := 1 to N do BEGIN If MatrizAdy[ i, j ] = 1 then BEGIN setcolor( red ); circle( 600 + 10*i, 45 + 10*j, 4 ); SetFillStyle( 1, White ); FloodFill( 600 + 10*i, 45 + 10*j, red ) END Else If MatrizAdy[ i, j ] = -1 then BEGIN setcolor( red ); circle( 600 + 10*i, 45 + 10*j, 4 ); SetFillStyle( 1, green ); FloodFill( 600 + 10*i, 45 + 10*j, red ) END Else BEGIN setcolor( RED ); circle( 600 + 10*i, 45 + 10 * j, 4 ); END END; { ciclo FOR } Outtextxy( 580, 35, 'MATRIZ DE ADYACENCIAS' ); Outtextxy( 580, 50, 'A = ' ); END; PROCEDURE Grafo; BEGIN ClearDevice; Outtextxy( 20, 30, '*** GRAFO DE ZEGGELINK (1995) ***' ); setcolor( yellow ); DibujarIndividuos; ActualizarVinculos; setcolor( Red ); DibujarMatrizAdyacencias; MostrarGeneracion; { Convenciones } setcolor( white ); Outtextxy( 255, 60, '-1-' ); Outtextxy( 525, 180, '-2-' ); Outtextxy( 6, 200, '-3-' ); Outtextxy( 475, 350, '-4-' ); Outtextxy( 95, 395, '-5-' ); Outtextxy( 300, 385, 'Individuo ( i ) : circulo mayor' ); Outtextxy( 300, 395, 'Vinculo posible : linea roja ' ); Outtextxy( 300, 405, 'Mensaje negativo : linea y circulo menor verde i --> j' ); Outtextxy( 300, 415, 'Eleccion positiva : linea y circulo menor blanco i --> j' ); Outtextxy( 300, 425, 'Vinculo de amistad : Doble linea blanca i <==> j' ); Outtextxy( 300, 440, 'Funcion de tension : Circulo mayor blanco T = 0 ' ); Outtextxy( 300, 450, ' Circulo mayor amarillo T <> 0 ' ); END; PROCEDURE PatronDeComportamiento1; BEGIN { Inicia nueva secuencia para los comportamientos de eleccion de cada individuo [ funcion T diferente de 0 ] } { Individuo 1 } If FuncionTensor[ 1 ] = 0 then BEGIN SetFillStyle( 1, white ); setcolor( 7 ); circle( x1, y1, 20 ); FloodFill( x1, y1, 7 ) END Else BEGIN SetFillStyle( 1, yellow ); setcolor( 7 ); circle( x1, y1, 20 ); FloodFill( x1, y1, 7 ) END; for i := 1 to N do BEGIN If MatrizAdy[ 1, i ] = -1 then MatrizAdy[ i, 1 ] := 0; If FuncionTensor[ 1 ] = 0 then MatrizAdy[ i, 1 ] := MatrizAdy[ i, 1 ] Else If ( FuncionTensor[ 1 ] > 0 ) and ( MatrizAdy[ 1, i ] = 1 ) then MatrizAdy[ i, 1 ] := 1 Else If ( FuncionTensor[ 1 ] < 0 ) then MatrizAdy[ EnteroAleatorio( 1, 6 ), 1 ] := 0; END; { Individuo 2 } If FuncionTensor[ 2 ] = 0 then BEGIN SetFillStyle( 1, white ); setcolor( 7 ); circle( x2, y2, 20 ); FloodFill( x2, y2, 7 ) END Else BEGIN SetFillStyle( 1, yellow ); setcolor( 7 ); circle( x2, y2, 20 ); FloodFill( x2, y2, 7 ) END; for i := 1 to N do BEGIN If MatrizAdy[ 2, i ] = -1 then MatrizAdy[ i, 2 ] := 0; If FuncionTensor[ 2 ] = 0 then MatrizAdy[ i, 2 ] := MatrizAdy[ i, 2 ] Else If ( FuncionTensor[ 2 ] > 0 ) and ( MatrizAdy[ 2, i ] = 1 ) then MatrizAdy[ i, 2 ] := 1 Else If ( FuncionTensor[ 2 ] < 0 ) then MatrizAdy[ EnteroAleatorio( 1, 6 ), 2 ] := 0; END; { Individuo 3 } If FuncionTensor[ 3 ] = 0 then BEGIN SetFillStyle( 1, white ); setcolor( 7 ); circle( x3, y3, 20 ); FloodFill( x3, y3, 7 ) END Else BEGIN SetFillStyle( 1, yellow ); setcolor( 7 ); circle( x3, y3, 20 ); FloodFill( x3, y3, 7 ) END; for i := 1 to N do BEGIN If MatrizAdy[ 3, i ] = -1 then MatrizAdy[ i, 3 ] := 0; If FuncionTensor[ 3 ] = 0 then MatrizAdy[ i, 3 ] := MatrizAdy[ i, 3 ] Else If ( FuncionTensor[ 3 ] > 0 ) and ( MatrizAdy[ 3, i ] = 1 ) then MatrizAdy[ i, 3 ] := 1 Else If ( FuncionTensor[ 3 ] < 0 ) then MatrizAdy[ EnteroAleatorio( 1, 6 ), 3 ] := 0; END; { Individuo 4 } If FuncionTensor[ 4 ] = 0 then BEGIN SetFillStyle( 1, white ); setcolor( 7 ); circle( x4, y4, 20 ); FloodFill( x4, y4, 7 ) END Else BEGIN SetFillStyle( 1, yellow ); setcolor( 7 ); circle( x4, y4, 20 ); FloodFill( x4, y4, 7 ) END; for i := 1 to N do BEGIN If MatrizAdy[ 4, i ] = -1 then MatrizAdy[ i, 4 ] := 0; If FuncionTensor[ 4 ] = 0 then MatrizAdy[ i, 4 ] := MatrizAdy[ i, 4 ] Else If ( FuncionTensor[ 4 ] > 0 ) and ( MatrizAdy[ 4, i ] = 1 ) then MatrizAdy[ i, 4 ] := 1 Else If ( FuncionTensor[ 4 ] < 0 ) then MatrizAdy[ EnteroAleatorio( 1, 6 ), 4 ] := 0; END; { Individuo 5 } If FuncionTensor[ 5 ] = 0 then BEGIN SetFillStyle( 1, white ); setcolor( 7 ); circle( x5, y5, 20 ); FloodFill( x5, y5, 7 ) END Else BEGIN SetFillStyle( 1, yellow ); setcolor( 7 ); circle( x5, y5, 20 ); FloodFill( x5, y5, 7 ) END; for i := 1 to N do BEGIN If MatrizAdy[ 5, i ] = -1 then MatrizAdy[ i, 5 ] := 0; If FuncionTensor[ 5 ] = 0 then MatrizAdy[ i, 5 ] := MatrizAdy[ i, 5 ] Else If ( FuncionTensor[ 5 ] > 0 ) and ( MatrizAdy[ 5, i ] = 1 ) then MatrizAdy[ i, 5 ] := 1 Else If ( FuncionTensor[ 5 ] < 0 ) then MatrizAdy[ EnteroAleatorio( 1, 6 ), 5 ] := 0; END; END; PROCEDURE EvolucionGrafo; CONST NumAmiPref = 2; { Numero preferido de amigos [ dfi ] para cada individuo i } VAR NumItera : smallint; NumAmigos, FuncionEvaluacion : vector; { Respectivamente, estas dos variables locales representan: (i) el numero actual de amigos del individuo i, (ii) la discrepancia que hay entre la evaluacion del numero preferido de amigos y el numero que tiene i en el instante actual, y (iii) una funcion que evalua que tan cerca se esta al estado o numero preferido de amigos } BEGIN writeln; writeln( ' Cuantas veces desea iterar las reglas de actualizacion ' ); readln( NumItera ); WHILE ( NumItera+1 <> t ) DO BEGIN for i := 1 to N do NumAmigos[ i ] := 0; { Calculo del numero actual de amigos de cada individuo [ fi ], considerando que la amistad es una relación recíproca del tipo i <==> j } for i := 1 to N do { Amigos del individuo 1 } If (MatrizAdy[ i, 1 ] = MatrizAdy[ 1, i ]) and (MatrizAdy[ i, 1 ] = 1) then NumAmigos[ 1 ] := NumAmigos[ 1 ] + MatrizAdy[ i, 1 ]; for i := 1 to N do { Amigos del individuo 2 } If (MatrizAdy[ i, 2 ] = MatrizAdy[ 2, i ]) and (MatrizAdy[ i, 2 ] = 1) then NumAmigos[ 2 ] := NumAmigos[ 2 ] + MatrizAdy[ i, 2 ]; for i := 1 to N do { Amigos del individuo 3 } If (MatrizAdy[ i, 3 ] = MatrizAdy[ 3, i ]) and (MatrizAdy[ i, 3 ] = 1) then NumAmigos[ 3 ] := NumAmigos[ 3 ] + MatrizAdy[ i, 3 ]; for i := 1 to N do { Amigos del individuo 4 } If (MatrizAdy[ i, 4 ] = MatrizAdy[ 4, i ]) and (MatrizAdy[ i, 4 ] = 1) then NumAmigos[ 4 ] := NumAmigos[ 4 ] + MatrizAdy[ i, 4 ]; for i := 1 to N do { Amigos del individuo 5 } If (MatrizAdy[ i, 5 ] = MatrizAdy[ 5, i ]) and (MatrizAdy[ i, 5 ] = 1) then NumAmigos[ 5 ] := NumAmigos[ 5 ] + MatrizAdy[ i, 5 ]; { Calculo de la funcion de tension de cada individuo } for i := 1 to N do FuncionTensor[ i ] := NumAmiPref - NumAmigos[ i ]; { Calculo de la funcion lineal de evaluacion : [ vi( fi ) := dfi - [ dfi - fi ], siendo [ x ] el valor absoluto } for i := 1 to N do FuncionEvaluacion[ i ] := NumAmiPref - round( ValorAbsoluto(NumAmiPref, NumAmigos[ i ])); writeln( '--El NUMERO DE AMIGOS de cada individuo es: ' ); for i := 1 to N do write( ' [ ', i, ' ] : ', NumAmigos[ i ], ' ' ); writeln( '--------------------------------------------' ); writeln( '--El vector de la FUNCION DE TENSION [ Ti := dfi - fi ] es: ' ); for i := 1 to N do write( ' [ ', i, ' ] : ', FuncionTensor[ i ], ' ' ); writeln( '--------------------------------------------' ); writeln( '--El vector de la FUNCION DE EVALUACION LINEAL es: ' ); for i := 1 to N do write( ' [ ', i, ' ] : ', FuncionEvaluacion[ i ], ' ' ); writeln( '--------------------------------------------' ); Grafo; t := t + 1; PatronDeComportamiento1; { writeln( ' Presione [Enter] ver siguiente generacion...' ); readln } END; END; PROCEDURE Seleccion; BEGIN REPEAT writeln; writeln( '--------------MENU PRINCIPAL----------------' ); writeln( 'Seleccione cualquiera de estas alternativas ' ); writeln( '--Ingresar datos elemento a elemento : 1' ); writeln( '--Asignar MatrizAdy[ 0..0, 0..0 ] : 2' ); writeln( '--Asignar MatrizAdy[ 1..1, 1..1 ] : 3' ); writeln( '--Asignar aleatoriamente vinculos : 4' ); writeln( '--Modificar elementos de MatrizAdy : 5' ); writeln( '--Mostrar grafo : 6' ); writeln( '--Aplicar reglas de evolucion : 7' ); writeln( '--Almacenar/Recuperar configuracion : 8' ); writeln( '--Cerrar aplicacion : 11' ); readln( EntradaUsuario ); CASE EntradaUsuario OF 1 : CapturaDeDatos; 2 : MatrizNula; 3 : MatrizUnitaria; 4 : AsignarAleatorio; 5 : ModificarMatriz; 6 : Grafo; 7 : EvolucionGrafo; 8 : AlmacenarEstado END; UNTIL EntradaUsuario = 11; writeln; writeln( ' Presione la tecla [Enter] para terminar el programa ' ); END; BEGIN { Programa principal } writeln( 'Aqui viene el grafo inicial... ' ); InitGraph( GD, GM, '..\BGI' ); MatrizNula; Grafo; Seleccion; readln; CloseGraph END. { Zeggeling, E. (1995). Evolving frienship networks: an individual-oriented approach implementing similarity. Social Networks, No. 17, pp. 83-110 }