next | previous | forward | backward | up | top | index | toc | Macaulay2 website
NautyGraphs :: graphComplement

graphComplement -- computes the complement of a graph

Synopsis

Description

This method computes the graph complement of the input graph and returns the result in the same format.

i1 : graphComplement "Dhc"

o1 = DUW
i2 : graphComplement graph {{1,2},{2,3},{3,4},{4,5},{1,5}}

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

o2 : Graph

Batch calls can be performed considerably faster when using the List input format. However, care should be taken as the returned list is entirely in Graph6 or Sparse6 format.

i3 : G = generateBipartiteGraphs 7;
i4 : time graphComplement G;
     -- used 0.00151335 seconds
i5 : time (graphComplement \ G);
     -- used 0.170644 seconds

Ways to use graphComplement :

For the programmer

The object graphComplement is a method function with options.