next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Posets :: randomPoset

randomPoset -- generates a random poset with a given relation probability

Synopsis

Description

This method generates a random poset with a given ground set ({1, ..., n}, if n is specified).
i1 : randomPoset 10

o1 = Poset{cache => CacheTable{}                                                                                                                                                                      }
           GroundSet => {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
           RelationMatrix => | 1 1 0 1 1 1 1 1 1 1 |
                             | 0 1 0 1 1 1 0 1 1 1 |
                             | 0 0 1 1 1 0 0 1 1 1 |
                             | 0 0 0 1 1 0 0 1 1 1 |
                             | 0 0 0 0 1 0 0 1 0 1 |
                             | 0 0 0 0 0 1 0 0 1 1 |
                             | 0 0 0 0 0 0 1 0 0 1 |
                             | 0 0 0 0 0 0 0 1 0 1 |
                             | 0 0 0 0 0 0 0 0 1 1 |
                             | 0 0 0 0 0 0 0 0 0 1 |
           Relations => {{1, 2}, {1, 4}, {1, 7}, {1, 9}, {1, 10}, {2, 4}, {2, 5}, {2, 6}, {2, 9}, {3, 4}, {3, 8}, {3, 10}, {4, 5}, {4, 8}, {4, 9}, {5, 8}, {6, 9}, {6, 10}, {7, 10}, {8, 10}, {9, 10}}

o1 : Poset
The option Bias determines the probability that a given relation will be present. A higher Bias will lead to more relations.
i2 : randomPoset(10, Bias => 0.1)

o2 = Poset{cache => CacheTable{}                         }
           GroundSet => {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
           RelationMatrix => | 1 0 0 0 0 0 0 0 1 1 |
                             | 0 1 0 0 1 0 0 0 0 0 |
                             | 0 0 1 0 0 1 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 0 0 0 |
                             | 0 0 0 0 0 0 0 1 0 0 |
                             | 0 0 0 0 0 0 0 0 1 1 |
                             | 0 0 0 0 0 0 0 0 0 1 |
           Relations => {{1, 9}, {2, 5}, {3, 6}, {9, 10}}

o2 : Poset
i3 : randomPoset(10, Bias => 0.9)

o3 = 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 1 1 1 1 1 1 1 1 |
                             | 0 0 1 1 1 1 1 1 1 1 |
                             | 0 0 0 1 1 1 1 1 1 1 |
                             | 0 0 0 0 1 1 1 1 1 1 |
                             | 0 0 0 0 0 1 1 1 1 1 |
                             | 0 0 0 0 0 0 1 1 1 1 |
                             | 0 0 0 0 0 0 0 1 1 1 |
                             | 0 0 0 0 0 0 0 0 1 1 |
                             | 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, 3}, {2, 4}, {2, 5}, {2, 6}, {2, 8}, {2, 9}, {2, 10}, {3, 4}, {3, 5}, {3, 6}, {3, 7}, {3, 8}, {3, 9}, {3, 10}, {4, 5}, {4, 6}, {4, 7}, {4, 8}, {4, 9}, {4, 10}, {5, 6}, {5, 7}, {5, 8}, {5, 9}, {5, 10}, {6, 7}, {6, 8}, {6, 10}, {7, 8}, {7, 9}, {8, 9}, {8, 10}, {9, 10}}

o3 : Poset

See also

Ways to use randomPoset :