Berkeley YACC
1993-03-03
Berkeley's version of Yet Another Compiler Compiler
|
#include "defs.h"
Go to the source code of this file.
Functions | |
transitive_closure (unsigned *R, int n) | |
reflexive_transitive_closure (unsigned *R, int n) | |
reflexive_transitive_closure | ( | unsigned * | R, |
int | n | ||
) |
Computes the transitive closure of a relation in-place.
Let \( \mathrm{R} \) be an \( \mathrm{n} \times \mathrm{n} \) matrix of bits expressing a relation between n elements, such that \( \mathrm{R}_{i,j} \) is set if and only if the i-th elements is in relation with the j-th one.
Then this function computes the reflexive and transitive closure of such relation and stores it in-place, using Warshall's algorithm. Its complexity is \( O\left( n^3 \right) \), dominated by the complexity of transitive_closure().
Internally, this function just calls transitive_closure() and then sets all elements on the matrix diagonal to make the relation reflexive.
Definition at line 79 of file warshall.c.
References BITS_PER_WORD, R, transitive_closure(), and WORDSIZE.
Referenced by set_EFF().
transitive_closure | ( | unsigned * | R, |
int | n | ||
) |
Computes the transitive closure of a relation in-place.
Let \( \mathrm{R} \) be an \( \mathrm{n} \times \mathrm{n} \) matrix of bits expressing a relation between n elements, such that \( \mathrm{R}_{i,j} \) is set if and only if the i-th elements is in relation with the j-th one.
Then this function computes the transitive closure of such relation and stores it in-place, using Warshall's algorithm. Its complexity is \( O\left( n^3 \right) \).
Definition at line 13 of file warshall.c.
References BITS_PER_WORD, R, and WORDSIZE.
Referenced by reflexive_transitive_closure().