PartiallyOrderedSets/ToGraph - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : PartiallyOrderedSets/ToGraph

PartiallyOrderedSets

  

ToGraph

  

Converts a poset into a graph object of the GraphTheory package

 

Calling Sequence

Parameters

Options

Description

Examples

References

Compatibility

Calling Sequence

ToGraph(P)

ToGraph(P,gopts,dgopts)

Parameters

P

-

PartiallyOrderedSet

gopts

-

(optional) zero or more options specific to the ToGraph command, of the form graded = b, reduction = b, setcoordinates = b where b is a boolean 

dgopts

-

(optional) zero or more options to be passed to the GraphTheory:-DrawGraph command

Options

• 

reduction = truefalse

  

There are two (potentially) different graphs that this command can generate: the graph where the arrows form the transitive reduction of the ordering of P, and the graph where the arrows form the transitive closure of the ordering. By default, ToGraph returns the transitive reduction graph (the Hasse diagram). When passed the option reduction = false, it returns the transitive closure graph. Passing the option reduction or reduction = true explicitly selects the default transitive reduction graph.

• 

setcoordinates = truefalse

  

When constructing the transitive reduction graph, Maple will by default compute a suitable layout of the vertices, so that a subsequent call to GraphTheory:-DrawGraph can use that layout. To disable this feature, you can pass the option setcoordinates = false. Passing the option setcoordinates or setcoordinates = true explicitly selects the default of computing the coordinates, but it cannot be passed if computing the transitive closure graph.

• 

graded = truefalse

• 

prefer = low or high

  

If Maple computes a layout for the graph, the options graded and prefer are used by the PartiallyOrderedSets:-DrawGraph command to fine-tune the layout. They are explained on that command's help page. The options cannot be used if computing the transitive closure graph.

• 

dgopts (not a literal option name)

  

If passing any extra options not mentioned before (represented by dgopts in the calling sequence above), they are passed on to the GraphTheory:-DrawGraph command.

Description

• 

The command ToGraph(P) returns the graph representation of the partially ordered set P as a graph object of the GraphTheory package. Vertices of the graph are elements of P, and directed edges represent relations between the elements.

Terminology

• 

A partially ordered set, or poset for short, is a pair (P, <=) where P is a set and <= is a partial order on P. The poset (P, <=) defines a directed graph whose vertices are the elements of P and (a,b) is a directed edge whenever a <= b holds. Conversely, a poset can be defined from a directed graph, assuming that the defined binary relation is anti-symmetric, and transitive, and, either reflexive, or irreflexive.

Examples

withPartiallyOrderedSets&colon;

leq`<=`&colon;

Create a poset from a set and a non-strict partial order

S1&comma;2&comma;3&comma;4&comma;5&colon;poset1PartiallyOrderedSetS&comma;leq

poset1< a poset with 5 elements >

(1)

Create the graph representation of this poset

GToGraphposet1

GGraph 1: a directed graph with 5 vertices and 4 arcs

(2)

Display this graph

GraphTheory:-DrawGraphG

Create a poset from a set and a strict partial order

lneq`<`&colon;poset1_1PartiallyOrderedSetS&comma;lneq

poset1_1< a poset with 5 elements >

(3)

Create the graph representation of this poset

G1_1ToGraphposet1_1

G1_1Graph 2: a directed graph with 5 vertices and 4 arcs

(4)

Display this graph

GraphTheory:-DrawGraphG1_1

Create a poset from a set and a non-strict partial order

divisibilityx&comma;yiremy&comma;x=0&colon;T3&comma;4&comma;5&comma;6&comma;7&comma;8&comma;9&colon;

poset2PartiallyOrderedSetT&comma;divisibility

poset2< a poset with 7 elements >

(5)

Create the graph representation of this poset

G2ToGraphposet2

G2Graph 3: a directed graph with 7 vertices and 3 arcs

(6)

Display this graph

GraphTheory:-DrawGraphG2

Create a poset from a set and a strict partial order

divisibNEx&comma;yiremy&comma;x=0andyx&colon;

poset2_1PartiallyOrderedSetT&comma;divisibNE&comma;reflexive=checkfalse

poset2_1< a poset with 7 elements >

(7)

Create the graph representation of this poset

G2_1ToGraphposet2_1

G2_1Graph 4: a directed graph with 7 vertices and 3 arcs

(8)

Display this graph

GraphTheory:-DrawGraphG2_1

Create a poset from a set and a non-strict partial order

U1&comma;2&comma;3&colon;

poset3PartiallyOrderedSetU&comma;leq&comma;reflexive=checktrue

poset3< a poset with 3 elements >

(9)

Create the graph representation of this poset

G3ToGraphposet3

G3Graph 5: a directed graph with 3 vertices and 2 arcs

(10)

Display this graph

GraphTheory:-DrawGraphG3

Create a poset from a set and a strict partial order

poset3_1PartiallyOrderedSetU&comma;lneq&comma;reflexive=useclosure

poset3_1< a poset with 3 elements >

(11)

Create the graph representation of this poset

G3_1ToGraphposet3_1

G3_1Graph 6: a directed graph with 3 vertices and 2 arcs

(12)

Display this graph

GraphTheory:-DrawGraphG3_1

Create a poset from a set and a non-strict partial order

X4&comma;5&comma;6&colon;poset3_2PartiallyOrderedSetX&comma;leq&comma;reflexive=checktrue

poset3_2< a poset with 3 elements >

(13)

Create the graph representation of this poset

G3_2ToGraphposet3_2

G3_2Graph 7: a directed graph with 3 vertices and 2 arcs

(14)

Display this graph

GraphTheory:-DrawGraphG3_2

Create a poset from a set and an adjacency matrix of a partial order regarded as a directed graph

adjMatrix4Matrix1&comma;1&comma;1&comma;1&comma;1&comma;0&comma;1&comma;1&comma;1&comma;1&comma;0&comma;0&comma;1&comma;1&comma;1&comma;0&comma;0&comma;0&comma;1&comma;1&comma;0&comma;0&comma;0&comma;0&comma;1

adjMatrix41111101111001110001100001

(15)

poset4PartiallyOrderedSetconvertS&comma;list&comma;adjMatrix4

poset4< a poset with 5 elements >

(16)

Create the graph representation of this poset

G4ToGraphposet4

G4Graph 8: a directed graph with 5 vertices and 4 arcs

(17)

Display this graph

GraphTheory:-DrawGraphG4

Create a poset from a set and an adjacency list of a partial order regarded as a directed graph

adjList5map2map&comma;`+`&comma;Array1&comma;4&comma;7&comma;2&comma;6&comma;3&comma;4&comma;5&comma;6&comma;7&comma;2

adjList53&comma;6&comma;94&comma;856789

(18)

poset5PartiallyOrderedSetconvertT&comma;list&comma;adjList5

poset5< a poset with 7 elements >

(19)

Create the graph representation of this poset

G5ToGraphposet5

G5Graph 9: a directed graph with 7 vertices and 3 arcs

(20)

Display this graph

GraphTheory:-DrawGraphG5

Create a poset from a set and a directed graph

GGraphTheory:-Graphdirected&comma;1&comma;2&comma;3&comma;4&comma;5&comma;6&comma;1&comma;1&comma;1&comma;2&comma;1&comma;3&comma;1&comma;4&comma;1&comma;5&comma;1&comma;6&comma;2&comma;2&comma;2&comma;4&comma;2&comma;6&comma;3&comma;3&comma;3&comma;5&comma;3&comma;6&comma;4&comma;4&comma;4&comma;6&comma;5&comma;5&comma;5&comma;6&comma;6&comma;6

GGraph 10: a directed graph with 6 vertices, 11 arcs, and 6 self-loops

(21)

poset6PartiallyOrderedSetG

poset6< a poset with 6 elements >

(22)

Create the graph representation of this poset

G6ToGraphposet6

G6Graph 11: a directed graph with 6 vertices and 6 arcs

(23)

Display this graph

GraphTheory:-DrawGraphG6

Create a poset from a set an adjacency matrix of the transitive reduction of a partial order on that set

poset7PartiallyOrderedSetconvertU&comma;list&comma;1|1|0&comma;0|1|1&comma;0|0|1&comma;input=transitivereduction

poset7< a poset with 3 elements >

(24)

Create the graph representation of this poset

G7ToGraphposet7

G7Graph 12: a directed graph with 3 vertices and 2 arcs

(25)

Display this graph

GraphTheory:-DrawGraphG7

Create a poset from a set and an adjacency list of the transitive reduction of a partial order on that set

poset8PartiallyOrderedSet1&comma;2&comma;3&comma;4&comma;5&comma;6&comma;Array1&comma;2&comma;3&comma;2&comma;4&comma;3&comma;5&comma;4&comma;6&comma;5&comma;6&comma;6&comma;input=transitivereduction

poset8< a poset with 6 elements >

(26)

Create the graph representation of this poset

G8ToGraphposet8

G8Graph 13: a directed graph with 6 vertices and 6 arcs

(27)

Display this graph

GraphTheory:-DrawGraphG8

Define a polyhedral set and get its dimension

tPolyhedralSets:-ExampleSets:-Octahedron

t&lcub;Coordinates&colon;x1&comma;x2&comma;x3Relations&colon;x1x2x31&comma;x1x2+x31&comma;x1+x2x31&comma;x1+x2+x31&comma;x1x2x31&comma;x1x2+x31&comma;x1+x2x31&comma;x1+x2+x31

(28)

dPolyhedralSets:-Dimensiont

d3

(29)

Collect the faces of this polyhedral set

t_facesseqopPolyhedralSets:-Facest&comma;dimension=i&comma;i=0..d&colon;

t_facest_facesunionPolyhedralSets:-ExampleSets:-EmptySetd&colon;

FLconvertt_faces&comma;list&colon;

Construct the face lattice of that polyhedral set

inclusion := proc(x,y) PolyhedralSets:-`subset`(FL[x],FL[y]) end proc:

polyhedral_posetPartiallyOrderedSetseqi&comma;i=1..nopsFL&comma;inclusion

polyhedral_poset< a poset with 28 elements >

(30)

Create the graph representation of this poset

G_POLYToGraphpolyhedral_poset

G_POLYGraph 14: a directed graph with 28 vertices and 62 arcs

(31)

Display this graph

GraphTheory:-DrawGraphG_POLY

Create a poset from a set and an adjacency matrix of a partial order regarded as a directed graph

MMatrix1&comma;1&comma;1&comma;1&comma;1&comma;0&comma;1&comma;1&comma;0&comma;1&comma;0&comma;0&comma;1&comma;0&comma;1&comma;0&comma;0&comma;0&comma;1&comma;1&comma;0&comma;0&comma;0&comma;0&comma;1&colon;

poset9PartiallyOrderedSetseq1..5&comma;M

poset9< a poset with 5 elements >

(32)

Create the graph representation of this poset

G9ToGraphposet9

G9Graph 15: a directed graph with 5 vertices and 5 arcs

(33)

Display this graph

GraphTheory:-DrawGraphG9

 

Create a poset from a set and a non-strict partial order

Z1&comma;2&comma;3&comma;4&comma;5&comma;6&comma;10&comma;12&comma;15&comma;20&comma;30&comma;60

Z1&comma;2&comma;3&comma;4&comma;5&comma;6&comma;10&comma;12&comma;15&comma;20&comma;30&comma;60

(34)

poset10PartiallyOrderedSetZ&comma;divisibility

poset10< a poset with 12 elements >

(35)

Create the graph representation of the transitive closure of this poset

G10_CToGraphposet10&comma;reduction=false

G10_CGraph 16: a directed graph with 12 vertices and 42 arcs

(36)

Display this graph

GraphTheory:-DrawGraphG10_C

Create the graph representation of the transitive reduction of this poset. If we need the graph structure for the transitive reduction but are not planning to display it, we can skip computing the layout using the option setcoordinates=false.

G10_RNCToGraphposet10&comma;setcoordinates=false

G10_RNCGraph 17: a directed graph with 12 vertices and 20 arcs

(37)

If we display it anyway, the layout is not particularly insightful.

GraphTheory:-DrawGraphG10_RNC

If we omit the setcoordinates=false option, Maple computes a layout that respects the grading of poset10.

G10_RCToGraphposet10

G10_RCGraph 17: a directed graph with 12 vertices and 20 arcs

(38)

GraphTheory:-DrawGraphG10_RC

References

  

Richard P. Stanley: Enumerative Combinatorics 1. 1997, Cambridge Studies in Advanced Mathematics. Vol. 49. Cambridge University Press.

Compatibility

• 

The PartiallyOrderedSets[ToGraph] command was introduced in Maple 2025.

• 

For more information on Maple 2025 changes, see Updates in Maple 2025.

See Also

PartiallyOrderedSets[AdjacencyList]

PartiallyOrderedSets[AreEqual]

PartiallyOrderedSets[AreIsomorphic]

PartiallyOrderedSets[ConnectedComponents]

PartiallyOrderedSets[DrawGraph]

PartiallyOrderedSets[GreatestElement]

PartiallyOrderedSets[GreatestLowerBound]

PartiallyOrderedSets[Height]

PartiallyOrderedSets[IsAntichain]

PartiallyOrderedSets[IsChain]

PartiallyOrderedSets[IsFaceLattice]

PartiallyOrderedSets[IsGraded]

PartiallyOrderedSets[IsLattice]

PartiallyOrderedSets[IsRanked]

PartiallyOrderedSets[LeastElement]

PartiallyOrderedSets[LeastUpperBound]

PartiallyOrderedSets[LessEqual]

PartiallyOrderedSets[MaximalAntichains]

PartiallyOrderedSets[MaximalChains]

PartiallyOrderedSets[MaximalElements]

PartiallyOrderedSets[MinimalElements]

PartiallyOrderedSets[NumberOfElements]

PartiallyOrderedSets[PartiallyOrderedSet]

PartiallyOrderedSets[Rank]

PartiallyOrderedSets[ToGraph]

PartiallyOrderedSets[TransitiveClosure]

PartiallyOrderedSets[TransitiveReduction]

PartiallyOrderedSets[Width]