warshall: Warshall's algorithm

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/ssa.R

Description

Warshall's algorithm to compute the transitive closure for an adjacency matrix.

Usage

1

Arguments

a

adjacency matrix

Value

a

transitive closure of the relation corresponding to a

Note

~~further notes~~

Author(s)

Patrick Crutcher

References

S. Warshal, A Theorem on Boolean Matrices. Journal of the Association of Computer Machinery, 9:11-12,1962

See Also

~~objects to See Also as help, ~~~

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(a) {
n<-nrow(a)
for (j in 1:n) {
    for(i in 1:n) {
        if (a[i,j]==1) a[i,]<-pmax(a[i,],a[j,])
        }
    }
return(a)
}
{warshall}

ssa documentation built on May 2, 2019, 5:54 p.m.

Related to warshall in ssa...