GraphDifference
Details and Options

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

Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Scope (5)Survey of the scope of standard use cases
GraphDifference works with undirected graphs:

https://wolfram.com/xid/0i1qh1frm-cc12xh


https://wolfram.com/xid/0i1qh1frm-kbwby


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


https://wolfram.com/xid/0i1qh1frm-dbshxt

Use rules to specify the graph:

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

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

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

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

The edges of the graph difference are the complement of the edges of the graphs:

https://wolfram.com/xid/0i1qh1frm-djgbmo

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

https://wolfram.com/xid/0i1qh1frm-eu2sds

The graph difference of any graph and itself is an empty graph:

https://wolfram.com/xid/0i1qh1frm-cqvir3


https://wolfram.com/xid/0i1qh1frm-elkhmh

The graph difference of any graph and its CompleteGraph is isomorphic to the complement of the graph:

https://wolfram.com/xid/0i1qh1frm-b1xu9g

https://wolfram.com/xid/0i1qh1frm-0v8ne

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

https://wolfram.com/xid/0i1qh1frm-jrp2tv

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

https://wolfram.com/xid/0i1qh1frm-eo7hj5

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