next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Nauty :: 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.

For graphs as defined in the EdgeIdeals package, one can use the complementGraph method to achieve the same effect; however, this method provides the option of not taking the complement if the complement has more edges than the graph itself.

i1 : R = QQ[a..e];
i2 : graphComplement cycle R

o2 = Graph{edges => {{a, c}, {a, d}, {b, d}, {b, e}, {c, e}}}
           ring => R
           vertices => {a, b, c, d, e}

o2 : Graph
i3 : graphComplement "Dhc"

o3 = DUW

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.

i4 : G = generateBipartiteGraphs 7;
i5 : time graphComplement G;
     -- used 0.000489635 seconds
i6 : time (graphComplement \ G);
     -- used 0.0345918 seconds

See also

Ways to use graphComplement :

For the programmer

The object graphComplement is a method function with options.