GraphProduct
✖
GraphProduct
Details and Options

- GraphProduct is also known as box product.
- GraphProduct is typically used to produce new graphs from Boolean combinations of initial graphs.
- GraphProduct[g1,g2] gives a graph with vertices formed from the Cartesian product of the vertices of g1 and vertices of g2. The vertices {u1,u2} and {v1,v2} are connected if u1v1 and u2 is connected to v2, or u2v2 and u1 is connected to v1.
- GraphProduct[g1,g2,"op"] gives a graph product of type "op" with edges {u1,u2}{v1,v2} subject to the following conditions:
-
"Cartesian" (u1v1 ∧ u2v2)∨(u2v2∧u1v1) "Conormal" (u1v1)∨(u2v2) "Lexicographical" (u1v1)∨(u1v1∧u2v2) "Normal" (u1v1∧u2v2)∨(u2v2∧u1v1)∨(u1v1∧u2v2) "Rooted" (u1v1 ∧ u2v2)∨(u1v1 ∧ u2v2r) "Tensor" (u1v1)∧(u2v2) - The vertex r is the first vertex in VertexList[g2].
- GraphProduct[g1,g2] is effectively equivalent to GraphProduct[g1,g2,"Cartesian"].
- GraphProduct works with undirected graphs, directed graphs, multigraphs and mixed graphs.

Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Scope (30)Survey of the scope of standard use cases
Directed Graphs (5)
GraphProduct works with directed graphs:

https://wolfram.com/xid/0cg5b7xd2-zq47nk


https://wolfram.com/xid/0cg5b7xd2-5opcl


https://wolfram.com/xid/0cg5b7xd2-lb4tx5


https://wolfram.com/xid/0cg5b7xd2-5komsb


https://wolfram.com/xid/0cg5b7xd2-wpl3zt

Undirected Graphs (5)
GraphProduct works with undirected graphs:

https://wolfram.com/xid/0cg5b7xd2-uv48kz


https://wolfram.com/xid/0cg5b7xd2-hf3no2


https://wolfram.com/xid/0cg5b7xd2-c1omjq


https://wolfram.com/xid/0cg5b7xd2-yvj1t


https://wolfram.com/xid/0cg5b7xd2-0zhqif

Mixed Graphs (5)
GraphProduct works with mixed graphs:

https://wolfram.com/xid/0cg5b7xd2-xxc6u3


https://wolfram.com/xid/0cg5b7xd2-lrsx54


https://wolfram.com/xid/0cg5b7xd2-4o5kuy


https://wolfram.com/xid/0cg5b7xd2-cz38bv


https://wolfram.com/xid/0cg5b7xd2-urfdvp

Multigraphs (5)
GraphProduct works with multigraphs:

https://wolfram.com/xid/0cg5b7xd2-tsn0f4


https://wolfram.com/xid/0cg5b7xd2-ssgm65


https://wolfram.com/xid/0cg5b7xd2-t1xhwo


https://wolfram.com/xid/0cg5b7xd2-expkz4


https://wolfram.com/xid/0cg5b7xd2-2d0zdg

Weighted Graphs (5)
GraphProduct works with weighted graphs:

https://wolfram.com/xid/0cg5b7xd2-7csf8k


https://wolfram.com/xid/0cg5b7xd2-jpcxhu


https://wolfram.com/xid/0cg5b7xd2-z0p727


https://wolfram.com/xid/0cg5b7xd2-rkv9ly


https://wolfram.com/xid/0cg5b7xd2-jl91ra

Special Graphs (5)
GraphProduct works on entity graphs:

https://wolfram.com/xid/0cg5b7xd2-9q5ywu

GraphProduct works on trees:

https://wolfram.com/xid/0cg5b7xd2-3nrjxt

Use rules to specify the graph:

https://wolfram.com/xid/0cg5b7xd2-weyyix

GraphProduct works with more than two graphs:

https://wolfram.com/xid/0cg5b7xd2-18b1vu

Generate a list of different graph products:

https://wolfram.com/xid/0cg5b7xd2-vt8dmp

https://wolfram.com/xid/0cg5b7xd2-b5h9xv

Properties & Relations (6)Properties of the function, and connections to other functions
For two graphs with vi vertices, the number of vertices of their product is v1 v2 :

https://wolfram.com/xid/0cg5b7xd2-vf4rqa

https://wolfram.com/xid/0cg5b7xd2-r610af

For two undirected graphs with vi vertices and ei edges, the number of edges of the Cartesian product is v1 e2+v2 e1:

https://wolfram.com/xid/0cg5b7xd2-1v9tiq

https://wolfram.com/xid/0cg5b7xd2-s4nwjo

https://wolfram.com/xid/0cg5b7xd2-owlx2z

https://wolfram.com/xid/0cg5b7xd2-u1y6x8


https://wolfram.com/xid/0cg5b7xd2-rgscwb

Lexicographical product is v1 e2+ e1v22 :

https://wolfram.com/xid/0cg5b7xd2-3xis6p

Normal product is v1 e2+v2 e1 + 2 e1e2:

https://wolfram.com/xid/0cg5b7xd2-sj10w7

Co-normal product is v12 e2+ e1v22 - 2e1e2:

https://wolfram.com/xid/0cg5b7xd2-ohf7yr


https://wolfram.com/xid/0cg5b7xd2-2lxl2c

The Cartesian product of two single edges is a cycle:

https://wolfram.com/xid/0cg5b7xd2-xrbynk

The normal product of two single edges is a complete graph:

https://wolfram.com/xid/0cg5b7xd2-fe7e69

The tensor product of two single edges is a cross:

https://wolfram.com/xid/0cg5b7xd2-z10r6r

TorusGraph[{m,n}] is the graph formed from the Cartesian product of the cycle graphs and
:

https://wolfram.com/xid/0cg5b7xd2-2xqjjb


https://wolfram.com/xid/0cg5b7xd2-l8vjru


https://wolfram.com/xid/0cg5b7xd2-irxwob

Wolfram Research (2022), GraphProduct, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphProduct.html.
Text
Wolfram Research (2022), GraphProduct, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphProduct.html.
Wolfram Research (2022), GraphProduct, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphProduct.html.
CMS
Wolfram Language. 2022. "GraphProduct." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/GraphProduct.html.
Wolfram Language. 2022. "GraphProduct." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/GraphProduct.html.
APA
Wolfram Language. (2022). GraphProduct. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GraphProduct.html
Wolfram Language. (2022). GraphProduct. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GraphProduct.html
BibTeX
@misc{reference.wolfram_2025_graphproduct, author="Wolfram Research", title="{GraphProduct}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/GraphProduct.html}", note=[Accessed: 08-July-2025
]}
BibLaTeX
@online{reference.wolfram_2025_graphproduct, organization={Wolfram Research}, title={GraphProduct}, year={2022}, url={https://reference.wolfram.com/language/ref/GraphProduct.html}, note=[Accessed: 08-July-2025
]}