cartesian | R Documentation |
Returns the adjacency matrix of the cartesian product of two graphs
given the adjacency matrix of each one, G
and H
.
cartesian(G, H = NULL)
G |
adjacency matrix of the first graph. |
H |
adjacency matrix of the second graph. If not provided,
it takes the same value as |
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)
J()
, tr()
, trdot()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.