Informatica

Páginas: 8 (1912 palabras) Publicado: 29 de marzo de 2012
Cierre transitivo
The program calculates transitive closure of a relation represented as an adjacency matrix. El programa calcula el cierre transitivo de la relación representada como una matriz de adyacencia. Element (i,j) in the matrix is equal to 1 if the pair (i,j) is in the relation. Elemento (i, j) en la matriz es igual a 1 si el par (i, j) está en la relación. Otherwise, it is equal to0. De lo contrario, es igual a 0.
For calculating transitive closure it uses Warshall's algorithm. Para el cálculo de cierre transitivo se utiliza el algoritmo de Warshall.
Algorithm Warshall Algoritmo Warshall
Input: The adjacency matrix of a relation R on a set with n elements. Entrada: La matriz de adyacencia de una relación R en un conjunto con n elementos.
Output: The adjacency matrixT of the transitive closure of R. Salida: La matriz de adyacencia T de la clausura transitiva de R.
Procedure: Procedimiento:
Start with T=A. Empieza con T = A.
For each j from 1 to n Para cada j desde 1 hasta n
For each i from 1 to n Para cada i desde 1 hasta n
If T(i,j)=1, then form the Boolean or of row iand row j Si T (i, j) = 1, entonces formar el booleano o de la fila y la fila j i
and replace row i by it. y sustituir la fila i por el mismo.
Go on to the next i-value. Ir a la siguiente i-valor.
Once you have processed each i-value, go on to the next j-value. Una vez que se han procesado cada i-valor,vaya a la siguiente j-valor.
The above description of the algorithm and proof of its correctness may be found in "Discrete Mathematics" by Kenneth P. Bogart. La anterior descripción del algoritmo y prueba de su corrección se puede encontrar en "Matemática Discreta", de Kenneth P. Bogart.
The program allows to specify the number of elements in the relation (from 1 to 20). El programa permiteespecificar el número de elementos en la relación (de 1 a 20). (Upper bound is set to 20 for the sake of nice graphics.) Pressing the button "New matrix" will result in creating a new matrix of a specified size. (Límite superior se establece en 20 para el bien de buenos gráficos.) Al presionar el botón "Nueva Matriz" se traducirá en la creación de una nueva matriz de un tamaño especificado. Elementswith value 0 are represented as empty cells, elements with values 1 are represented as cells containing "1". Los elementos con valor 0 se representan como celdas vacías, los elementos con valores 1 se representan como las células que contienen "1". Clicking on an empty cell will change its value to 1. Al hacer clic en una celda vacía va a cambiar su valor en 1. Clicking on a cell with "1" willchange its value back to an empty cell. Al hacer clic en una celda con "1" va a cambiar su valor a una celda vacía.
After you have specified the relation press "Find transitive closure" button to see its transitive closure. Después de haber especificado la prensa relación "Buscar cierre transitivo" para ver su cierre transitivo.
Press the button to see the program. CIERRE TRANSSITIVO
| |
|We have seen Adjacency Matrix, which tells you whose directly connected to whom, no! Hemos visto matriz de adyacencia, que le dice cuya conectado directamente a quien, no! Remember, I left a special note there, saying that there can be many other paths which may exist and might not be visible from the Adjacency matrix, as these paths may have intermediate vertices. Recuerda, yo dejé una notaespecial allí, diciendo que no puede haber muchos otros caminos que puedan existir y podría no ser visible desde la matriz de adyacencia, ya que estos caminos puede tener vértices intermedios. To find all such round about or via-paths there is a procedure to be followed, known as the transitive closure, which results in a matrix showing all those via-paths, if ever exist. Para saber todo acerca de...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Informatica
  • Informatica
  • Informatica
  • Informatica
  • Informatica
  • Informática
  • Informatica
  • Informatica

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS