Macaulay2 » Documentation
Packages » NautyGraphs :: graphComplement
next | previous | forward | backward | up | index | toc

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.00048333s (cpu); 0.00040246s (thread); 0s (gc)
i5 : time (graphComplement \ G);
 -- used 0.112055s (cpu); 0.109085s (thread); 0s (gc)

Ways to use graphComplement :

For the programmer

The object graphComplement is a method function with options.