GraphDifference

GraphDifference[g1,g2]

gives the graph difference of the graphs g1 and g2.

GraphDifference[{vw,},]

uses rules vw to specify the graph g.

Details and Options

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

Examples

open allclose all

Basic Examples  (1)

Obtain the graph difference of two graphs:

Highlight the graph difference:

Scope  (5)

GraphDifference works with undirected graphs:

Directed graphs:

Multigraphs:

Mixed graphs:

Use rules to specify the graph:

Properties & Relations  (6)

The vertices of the graph difference are the union of the vertices of the graphs:

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

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

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

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

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

Introduced in 2010
 (8.0)
 |
Updated in 2014
 (10.0)
2015
 (10.3)