示例#1
0
 def test_27(self):
     """
     Nodes and partitions
     """
     d0 = POSetOps.instance().sym2basis('ABCD')
     x0 = POSetOps.instance().adjacency(d0)
     logger.info("dict: {}".format(x0['m']))
     nodes = tuple(x0['n'])
     logger.info("nodes: {} {}".format(len(nodes), nodes))
     edges = tuple(x0['e'])
     logger.info("edges: {} {}".format(len(edges), edges))
示例#2
0
 def test_09(self):
     """
     Partitions
     """
     l0 = POSetOps.instance().partitions(set('ABC'))
     l0 = list(l0)
     logger.info("unordered: " + str(l0))
示例#3
0
 def test_13(self):
     """
     weak orderings
     """
     l0 = POSetOps.instance().partitions(list('ABC'))
     l0 = [ list(l) for l in list(l0) ]
     l1 = [ len(l) for l in list(l0) ]
     logger.info("ordered: {} {} {}".format(len(l0), l1, l0))
示例#4
0
    def test_15(self):
        """
        Partial order

        Partial order: A000670
        """
        p0 = POSetOps.instance()

        for s in self.ss:
            x0 = p0.partial_order(s)
            logger.info("partial: {} {:.80}".format(len(x0), str(x0)))
示例#5
0
 def test_21(self):
     """
     Nodes and partitions
     """
     p0 = POSetOps.instance()
     x0 = p0.adjacency('ABC')
     self.assertIsNotNone(x0)
     logger.info("counts: {}".format(p0._counts(x0)))
     s0 = [ string.ascii_letters[0:n] for n in range(1,6) ]
     for s in s0:
         logger.info(p0._counts(p0.adjacency(s)))
示例#6
0
    def test_29(self):
        """
        Nodes and partitions
        """
        x0 = POSetOps.instance().adjacency('ABC')
        self.assertIsNotNone(x0)
        logger.info("dict: {}".format(x0['m']))
        nodes = tuple(x0['n'])
        logger.info("nodes: {} {}".format(len(nodes), nodes))
        edges = tuple(x0['e'])
        logger.info("edges: {} {}".format(len(edges), edges))

        x1 = POSetOps.instance().remap(adjacency0=x0)
        self.assertIsNotNone(x1)
        logger.info("keys: {}".format(x1.keys()))

        nodes = tuple(x1['nodes'].values())
        logger.info("nodes: {} {}".format(len(nodes), nodes))
        edges = tuple(x1['edges'])
        logger.info("edges: {} {}".format(len(edges), edges))
示例#7
0
    def test_10(self):
        """
        Unordered Bell 

        Total ordering: A000142
        """
        p0 = POSetOps.instance()

        for s in self.ss:
            n0 = int(scis.perm(len(s), len(s)))
            n1 = len(tuple(p0.total_order(s)))
            self.assertEqual(n0, n1)
            logger.info("total ordering: {}: {} == {}".format(len(s), n0, n1))
示例#8
0
    def test_11(self):
        """
        Unordered Bell 

        Equivalence relation: A000110
        """
        p0 = POSetOps.instance()
        logger.info("unordered Bell: {}".format(p0.unordered_Bell(3)))

        for s in self.ss:
            n0 = p0.unordered_Bell(len(s))
            n1 = len(tuple(p0.partitions(set(s))))
            self.assertEqual(n0, n1)
            logger.info("eqivalence: {}: {} == {}".format(len(s), n0, n1))
示例#9
0
    def test_13(self):
        """
        Ordered Bell 

        Total preorder: A000670
        """
        p0 = POSetOps.instance()
        logger.info("ordered Bell: {}".format(p0.ordered_Bell(3)))

        for s in self.ss:
            n0 = p0.ordered_Bell(len(s))
            n1 = len(tuple(p0.weak_orderings(syms=s)))
            self.assertEqual(n0, n1)
            logger.info("ordered Bell: {}: {} == {}".format(len(s), n0, n1))
示例#10
0
 def test_23(self):
     """
     Nodes and partitions
     """
     p0 = POSetOps.instance()
     n = 4
     s0 = string.ascii_letters[0:n]
     a0 = p0.sym2basis(s0)
     logger.info(a0)
     nodes = p0._nodes(a0)
     logger.info(nodes)
     faces = p0._faces(nodes, ndiff=2, nX=1)
     logger.info(faces)
     logger.info("n: {}; nodes: {}; faces: {}".format(n, len(nodes), len(faces)))
     logger.info("n: {}; #faces: {}".format(n, 2 - (len(nodes) - len(faces))))
示例#11
0
 def test_03(self):
     s0 = POSetOps.instance().strong("ABCD")
     logger.info("strong: " + str(s0))
示例#12
0
 def test_23(self):
     """
     Nodes and partitions
     """
     d0 = POSetOps.instance().sym2basis('ABC')
     logger.info("dict: {}".format(d0))