Macaulay2 » Documentation
Packages » Graphs :: completeMultipartiteGraph
next | previous | forward | backward | up | index | toc

# completeMultipartiteGraph -- constructs a complete multipartite graph

- Usage:
    `G = completeMultipartiteGraph P`
- Inputs:
  - P, a list, if P has k elements, the graph is k-partite. P_i determines how many vertices are in each partite group
- Outputs:
  - G, a graph, a complete multipartite graph

## Description

A complete multipartite graph is a graph that is first and foremost multi-partite. That is, the vertex set of a complete multipartite graph can be partitioned into k sets such that within each set, none of the vertices are connected by an edge. The second condition is that each vertex is connected to ever vertex except for those in its partition so that it is "almost" a complete graph. For programming this graph, the input is a list P. The length of the list P will be the number of groups of vertices. For example, in a complete bipartite graph, the length of the list would be 2. The entry P_i will determine how many vertices are in each partition; necessarily, we see that the entries of the list must be positive integers.

    i1 : G = completeMultipartiteGraph {1,2,3}

    o1 = Graph{0 => {1, 2, 3, 4, 5}}
               1 => {0, 3, 4, 5}
               2 => {0, 3, 4, 5}
               3 => {0, 1, 2}
               4 => {0, 1, 2}
               5 => {0, 1, 2}

    o1 : Graph

## Ways to use completeMultipartiteGraph:

- `completeMultipartiteGraph(List)`

## For the programmer

The object completeMultipartiteGraph is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Graphs.m2:2470:0.