Macaulay2 » Documentation
Packages » Posets :: comparabilityGraph
next | previous | forward | backward | up | index | toc

# comparabilityGraph -- produces the comparability graph of a poset

- Usage:
    `G = comparabilityGraph P`
- Inputs:
  - P, an instance of the type Poset,
- Outputs:
  - G, a graph, which has an edge between two vertices if they are comparable in $P$

## Description

The comparability graph of a poset $P$ is the Graph with vertices given by the ground set of $P$ and which has edges between two vertices if they are comparable in $P$.

    i1 : comparabilityGraph booleanLattice 3

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

    o1 : Graph

## Caveat

This method renames the vertices with integers $0, 1, \ldots$ corresponding to the index of the vertices in the GroundSet.

## See also

- compare -- compares two elements in a poset
- incomparabilityGraph -- produces the incomparability graph of a poset
- isComparabilityGraph -- determines if a graph is the comparability graph of a poset
- transitiveOrientation -- generates a poset whose comparability graph is the given graph

## Ways to use comparabilityGraph:

- `comparabilityGraph(Poset)`

## For the programmer

The object comparabilityGraph is a method function.

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