Macaulay2 » Documentation
Packages » EdgeIdeals :: completeMultiPartite
next | previous | forward | backward | up | index | toc

completeMultiPartite -- returns a complete multipartite graph

Synopsis

Description

A complete multipartite graph is a graph with a partition of the vertices such that every pair of vertices, not both from the same partition, is an edge of the graph. The partitions can be specified by their number and size, by a list of sizes, or by an explicit partition of the variables. Not all variables of the ring need to be used.

i1 : R = QQ[a,b,c,x,y,z];
i2 : completeMultiPartite(R,2,3)

o2 = Graph{"edges" => {{a, x}, {a, y}, {a, z}, {b, x}, {b, y}, {b, z}, {c, x}, {c, y}, {c, z}}}
           "ring" => R
           "vertices" => {a, b, c, x, y, z}

o2 : Graph
i3 : completeMultiPartite(R,{2,4})

o3 = Graph{"edges" => {{a, c}, {a, x}, {a, y}, {a, z}, {b, c}, {b, x}, {b, y}, {b, z}}}
           "ring" => R
           "vertices" => {a, b, c, x, y, z}

o3 : Graph
i4 : completeMultiPartite(R,{{a,b,c,x},{y,z}})

o4 = Graph{"edges" => {{a, y}, {a, z}, {b, y}, {b, z}, {c, y}, {c, z}, {x, y}, {x, z}}}
           "ring" => R
           "vertices" => {a, b, c, x, y, z}

o4 : Graph

When n is the number of variables and M = 1, we recover the complete graph.

i5 : R = QQ[a,b,c,d,e];
i6 : t1 = completeMultiPartite(R,5,1)

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

o6 : Graph
i7 : t2 = completeGraph R

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

o7 : Graph
i8 : t1 == t2

o8 = true

See also

Ways to use completeMultiPartite :

For the programmer

The object completeMultiPartite is a method function.