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, GG and HH.

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)A(G),\ A(H) be the adjacency matrices of the graphs G, HG,\ H such that V(G)=n|V(G)| = n and V(H)=m|V(H)| = m, then the adjacency matrix of the cartesian product G×HG \times H is given by

A(G×H)=A(G)Im x m+In x nA(H)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]