transClos: Transitive closure of a graph

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Computes the transitive closure of a graph (undirected or directed acyclic).

Usage

1
transClos(amat)

Arguments

amat

a Boolean matrix with dimnames representing the adjacency matrix of a graph.

Details

The transitive closure of a directed graph with adjacency matrix A is a graph with adjacency matrix A^* such that A^*_{i,j} = 1 if there is a directed path from i to j. The transitive closure of an undirected graph is defined similarly (by substituting path to directed path).

Value

A

The adjacency matrix of the transitive closure.

Author(s)

Giovanni M. Marchetti

See Also

DAG, UG

Examples

1
2
3
4
5
6
7
## Closure of a DAG
d <- DAG(y ~ x, x ~ z)
transClos(d)

## Closure of an UG
g <- UG(~ x*y*z+z*u+u*v)
transClos(g)

Example output

Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union


Attaching package: 'ggm'

The following object is masked from 'package:igraph':

    pa

  y x z
y 0 0 0
x 1 0 0
z 1 1 0
  x y z u v
x 0 1 1 1 1
y 1 0 1 1 1
z 1 1 0 1 1
u 1 1 1 0 1
v 1 1 1 1 0

ggm documentation built on March 26, 2020, 7:49 p.m.

Related to transClos in ggm...