Macaulay2 » Documentation
Packages » Graphs :: complementGraph
next | previous | forward | backward | up | index | toc

complementGraph -- Returns the complement of a graph

Synopsis

Description

The complement graph of a graph G is the graph G^c where any two vertices are adjacent in G^c iff they are not adjacent in G. The original vertex set is preserved, only the edges are changed.

i1 : G = cycleGraph 4

o1 = Graph{0 => {1, 3}}
           1 => {0, 2}
           2 => {1, 3}
           3 => {0, 2}

o1 : Graph
i2 : complementGraph G

o2 = Graph{0 => {2}}
           1 => {3}
           2 => {0}
           3 => {1}

o2 : Graph

Ways to use complementGraph :

For the programmer

The object complementGraph is a method function.