This folder contains extra code that may be interesting/useful in working with partially ordered sets.
Some of these files are sequestered here
because they load other packages. Some might be of marginal value. Some
might be incorporated into Posets in the future.
Please see the HasseDiagram package that
supercedes the pplot.jl and posetplot.jl files that were in this directory.
Function provided:
containment_order(list): Given a list of distinct objects for whichissubseteqis defined, create a posetpin whichi<jexactly whenlist[i] ⊆ list[j].
This file provides the function poset_converter that may be use to convert a poset
defined in this Posets module (called Poset) to a poset (called SimplePoset)
in the SimplePosets module.
A simple call to poset_convert(p) converts p from one
type to the other.
Note: The functions defined in the
PosetandSimplePosethave a lot of the same names. This can cause conflicts. It may be necessary to invoke a functionfeither asPosets.forSimplePosets.fto deal with the clash.
Function provided:
divisors_poset(n): Create a poset whose elements correspond to the divisors of the (positive) integern. In this poset we havea < bprovided thea-th divisor ofnis a factor of theb-th divisor.- This can also be invoked as
divisor_poset(list)wherelistis a list (Vector) of distinct positive integers to be ordered by divisibility.
Functions provided:
-
semiorder(xs)creates a semiorder. Herexsis a list ofnreal numbers. The result is a poset withnelements in whichi<jwhenx[i] ≤ x[j]-1. More generally, usesemiorder(xs,t)in which casei<jwhenx[i] ≤ x[j]-t. Settingt=0gives a total order (if the values inxsare distinct). Iftis negative, errors may be thrown. -
interval_order(JJ)creates an interval order. HereJJis a vector ofClosedIntervals. In this poset we havea < bprovidedJJ[a]lies entirely to the left ofJJ[b]. -
random_interval_order(n)creates a random interval order withnelements. This is done by creatingnrandom intervals and invokinginterval_order.
The function partition_lattice(n) returns a pair (p, tab).
pis the poset containing all partitions of the set{1,2,...,n}ordered by refinement. The least element of this poset is{{1},{2},...,{n}}and the largest element of this poset is{{1,2,...,n}}.tabis table containing the partitions of{1,2,...,n}so that elementaofpcorresponds to the paritiontab[a].
The function partition_lattice_demo prints out a maximal chain in a partition lattice.
julia> using ShowSet
julia> partition_lattice_demo(5)
{{1},{2},{4},{3},{5}} < {{1,5},{2},{4},{3}} < {{4},{3},{1,2,5}} < {{1,2,4,5},{3}} < {{1,2,3,4,5}}