Skip to contents

Compute the direct product of two graphs

Usage

graph_direct(g, h)

Arguments

g

An igraph object

h

An igraph object

Value

Direct product as igraph object

Details

See https://en.wikipedia.org/wiki/Tensor_product_of_graphs. The result is undirected and its vertices are named "u-v", where u and v are the names (or ids) of the vertices in g and h.

Author

David Schoch

Examples

library(igraph)
g <- make_ring(4)
h <- make_full_graph(2)
graph_direct(g, h)
#> IGRAPH ab42e43 UN-- 8 8 -- 
#> + attr: name (v/c)
#> + edges from ab42e43 (vertex names):
#> [1] 1-1--2-2 1-2--2-1 2-1--3-2 2-2--3-1 3-1--4-2 3-2--4-1 1-1--4-2 1-2--4-1