next | previous | forward | backward | up | top | index | toc | Macaulay2 website
EdgeIdeals :: getCliques

getCliques -- returns cliques in a graph

Synopsis

Description

A clique of a graph is a subset of its vertices which induces a complete subgraph. That is, a set of vertices is a clique if every pair of vertices in the set forms an edge of the graph. This function returns all cliques of a specified size, and if no size is given, it returns all cliques. Note that all the edges of the graph are considered cliques of size two.

i1 : R = QQ[a..d];
i2 : G = completeGraph R

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

o2 : Graph
i3 : getCliques(G,3)

o3 = {{a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}}

o3 : List
i4 : getCliques(G,4)

o4 = {{a, b, c, d}}

o4 : List
i5 : getCliques G

o5 = {{a, b}, {a, c}, {b, c}, {a, d}, {b, d}, {c, d}, {a, b, c}, {a, b, d},
     ------------------------------------------------------------------------
     {a, c, d}, {b, c, d}, {a, b, c, d}}

o5 : List

See also

Ways to use getCliques :

For the programmer

The object getCliques is a method function.