i1 : G = {a,b,c,d}; |
i2 : R = {{a,b}, {a,c}, {c,d}}; |
i3 : P = poset(G, R) o3 = Poset{cache => CacheTable{} } GroundSet => {a, b, c, d} RelationMatrix => | 1 1 1 1 | | 0 1 0 0 | | 0 0 1 1 | | 0 0 0 1 | Relations => {{a, b}, {a, c}, {c, d}} o3 : Poset |
i4 : poset {{1,2},{2,3},{3,4}} o4 = Poset{cache => CacheTable{} } GroundSet => {1, 2, 3, 4} RelationMatrix => | 1 1 1 1 | | 0 1 1 1 | | 0 0 1 1 | | 0 0 0 1 | Relations => {{1, 2}, {2, 3}, {3, 4}} o4 : Poset |
i5 : cmp = (a,b) -> b % a == 0; |
i6 : G = toList(1..10); |
i7 : P = poset(G, cmp) o7 = Poset{cache => CacheTable{} } GroundSet => {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} RelationMatrix => | 1 1 1 1 1 1 1 1 1 1 | | 0 1 0 1 0 1 0 1 0 1 | | 0 0 1 0 0 1 0 0 1 0 | | 0 0 0 1 0 0 0 1 0 0 | | 0 0 0 0 1 0 0 0 0 1 | | 0 0 0 0 0 1 0 0 0 0 | | 0 0 0 0 0 0 1 0 0 0 | | 0 0 0 0 0 0 0 1 0 0 | | 0 0 0 0 0 0 0 0 1 0 | | 0 0 0 0 0 0 0 0 0 1 | Relations => {{1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8}, {1, 9}, {1, 10}, {2, 4}, {2, 6}, {2, 8}, {2, 10}, {3, 6}, {3, 9}, {4, 8}, {5, 10}} o7 : Poset |
i8 : S = QQ[x,y,z]; |
i9 : G = {x^2, x*y, z^2, x^2*y*z, x*y*z^3, x^2*y^2*z^3}; |
i10 : R = flatten for g in G list for h in G list if h %g == 0 then {g,h} else continue; |
i11 : M = matrix apply(G, g -> apply(G, h -> if h %g == 0 then 1 else 0)); 6 6 o11 : Matrix ZZ <--- ZZ |
i12 : P = poset(G, R, M) o12 = Poset{cache => CacheTable{} } 2 2 2 3 2 2 3 GroundSet => {x , x*y, z , x y*z, x*y*z , x y z } RelationMatrix => | 1 0 0 1 0 1 | | 0 1 0 1 1 1 | | 0 0 1 0 1 1 | | 0 0 0 1 0 1 | | 0 0 0 0 1 1 | | 0 0 0 0 0 1 | 2 2 2 2 2 2 2 3 2 3 2 2 3 2 2 2 3 2 2 2 3 2 2 2 2 2 3 3 3 3 2 2 3 2 2 3 2 2 3 Relations => {{x , x }, {x , x y*z}, {x , x y z }, {x*y, x*y}, {x*y, x y*z}, {x*y, x*y*z }, {x*y, x y z }, {z , z }, {z , x*y*z }, {z , x y z }, {x y*z, x y*z}, {x y*z, x y z }, {x*y*z , x*y*z }, {x*y*z , x y z }, {x y z , x y z }} o12 : Poset |
In the previous example the vertices of the poset were RingElements (missing documentation). In fact, the Posets package does not require the vertices to be of any particular type. However, this also means when the package makes calls to external methods, it sometimes must relabel the vertices (usually to the index of the vertex in G).