GraphComplement - Maple Help

# Online Help

###### All Products    Maple    MapleSim

GraphTheory

 GraphComplement
 construct complement of graph

 Calling Sequence GraphComplement(G)

Parameters

 G - graph

Description

 • GraphComplement returns the complement of a graph G, that is the graph with the same vertex set as G, but whose edge (arc) set consists of the edges (arcs) not present in G.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $C≔\mathrm{CycleGraph}\left(5\right)$
 ${C}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 5 vertices and 5 edge\left(s\right)}}$ (1)
 > $G≔\mathrm{GraphComplement}\left(C\right)$
 ${G}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 5 vertices and 5 edge\left(s\right)}}$ (2)
 > $\mathrm{Edges}\left(C\right)$
 $\left\{\left\{{1}{,}{2}\right\}{,}\left\{{1}{,}{5}\right\}{,}\left\{{2}{,}{3}\right\}{,}\left\{{3}{,}{4}\right\}{,}\left\{{4}{,}{5}\right\}\right\}$ (3)
 > $\mathrm{Edges}\left(G\right)$
 $\left\{\left\{{1}{,}{3}\right\}{,}\left\{{1}{,}{4}\right\}{,}\left\{{2}{,}{4}\right\}{,}\left\{{2}{,}{5}\right\}{,}\left\{{3}{,}{5}\right\}\right\}$ (4)
 > $\mathrm{DrawGraph}\left(C\right)$
 > $\mathrm{DrawGraph}\left(G\right)$

 See Also