GraphUnion
✖
GraphUnion
Details and Options

- The graph union Graph[v1,e1]⋃Graph[v2,e2] is given by Graph[v1⋃v2,e1⋃e2].
- GraphUnion works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

Background & Context
- GraphUnion gives a new graph obtained from a set of two or more directed or undirected graphs obtained by separately taking the union of the original vertex and edge sets. For edges with the same vertex labels in different graphs, GraphUnion keeps only one of them. The resulting graph keeps the vertex labels of the unique original edges.
- Related functions include GraphDisjointUnion, GraphIntersection, and GraphDifference. Unlike GraphUnion, GraphDisjointUnion keeps all edges even if multiple edges exist in different graphs that have the same vertex labels. GraphIntersection gives the graph obtained from the union of vertex sets and intersection of edge sets of the original graphs. GraphDifference gives the graph obtained from the union of vertex sets of two graphs and the complement of the second graph’s edge set with respect to the first. GraphComplement gives the graph that has the same vertex set as a given graph, but with edges corresponding to absent edges in the original (and vice versa).
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Scope (6)Survey of the scope of standard use cases
GraphUnion works with undirected graphs:

https://wolfram.com/xid/0tz1rtlu-cqa97c


https://wolfram.com/xid/0tz1rtlu-bhjscp


https://wolfram.com/xid/0tz1rtlu-jkqgp


https://wolfram.com/xid/0tz1rtlu-iy93i5

Use rules to specify the graph:

https://wolfram.com/xid/0tz1rtlu-bndh30

GraphUnion works with more than two graphs:

https://wolfram.com/xid/0tz1rtlu-fi43l1

Properties & Relations (7)Properties of the function, and connections to other functions
The vertices of the graph union are the union of the vertices of the graphs:

https://wolfram.com/xid/0tz1rtlu-e0o8hx

https://wolfram.com/xid/0tz1rtlu-gk8fqy

The edges of the graph union are the union of the edges of the graphs:

https://wolfram.com/xid/0tz1rtlu-czor38

https://wolfram.com/xid/0tz1rtlu-zrwkg

https://wolfram.com/xid/0tz1rtlu-6cs1c0

https://wolfram.com/xid/0tz1rtlu-83gcfq

The graph union of a graph and its subgraph is isomorphic to itself:

https://wolfram.com/xid/0tz1rtlu-dan2dz

https://wolfram.com/xid/0tz1rtlu-ko2n2b

The graph union of any simple graph and its complement is a complete graph:

https://wolfram.com/xid/0tz1rtlu-hch6zr

https://wolfram.com/xid/0tz1rtlu-emajil

The GraphUnion of two graphs has the same vertices as GraphDifference:

https://wolfram.com/xid/0tz1rtlu-8oqxj

The GraphUnion of two graphs has the same vertices as GraphIntersection:

https://wolfram.com/xid/0tz1rtlu-byfrs

The GraphDisjointUnion can be found using GraphUnion:

https://wolfram.com/xid/0tz1rtlu-m35yuo

https://wolfram.com/xid/0tz1rtlu-euu882

Wolfram Research (2010), GraphUnion, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphUnion.html (updated 2015).
Text
Wolfram Research (2010), GraphUnion, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphUnion.html (updated 2015).
Wolfram Research (2010), GraphUnion, Wolfram Language function, https://reference.wolfram.com/language/ref/GraphUnion.html (updated 2015).
CMS
Wolfram Language. 2010. "GraphUnion." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/GraphUnion.html.
Wolfram Language. 2010. "GraphUnion." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/GraphUnion.html.
APA
Wolfram Language. (2010). GraphUnion. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GraphUnion.html
Wolfram Language. (2010). GraphUnion. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GraphUnion.html
BibTeX
@misc{reference.wolfram_2025_graphunion, author="Wolfram Research", title="{GraphUnion}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/GraphUnion.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_graphunion, organization={Wolfram Research}, title={GraphUnion}, year={2015}, url={https://reference.wolfram.com/language/ref/GraphUnion.html}, note=[Accessed: 29-March-2025
]}