cartesian {qwalkr}R Documentation

Adjacency Matrix of the Cartesian Product

Description

Returns the adjacency matrix of the cartesian product of two graphs given the adjacency matrix of each one, G and H.

Usage

cartesian(G, H = NULL)

Arguments

G

adjacency matrix of the first graph.

H

adjacency matrix of the second graph. If not provided, it takes the same value as G.

Value

Let A(G),\ A(H) be the adjacency matrices of the graphs G,\ H such that |V(G)| = n and |V(H)| = m, then the adjacency matrix of the cartesian product G \times H is given by

A(G \times H) = A(G) \otimes I_{m\ x\ m} + I_{n\ x\ n} \otimes A(H)

See Also

J(), tr(), trdot()

Examples

P3 <- matrix(c(0,1,0,1,0,1,0,1,0), nrow=3)
K3 <- matrix(c(0,1,1,1,0,1,1,1,0), nrow=3)

# Return the adjacency matrix of P3 X K3
cartesian(P3, K3)

# Return the adjacency matrix of P3 X P3
cartesian(P3)

[Package qwalkr version 0.1.0 Index]