示例#1
0
    def _get_random_ribbon_graph(self):
        r"""
        Return a random ribbon graph with right parameters.
        """
        n = random.randint(self.min_num_seps, self.max_num_seps)
        S = SymmetricGroup(2 * n)

        e = S([(2 * i + 1, 2 * i + 2) for i in range(n)])
        f = S.random_element()
        P = PermutationGroup([e, f])

        while not P.is_transitive():
            f = S.random_element()
            P = PermutationGroup([e, f])

        return RibbonGraph(edges=[e(i + 1) - 1 for i in range(2 * n)],
                           faces=[f(i + 1) - 1 for i in range(2 * n)])
示例#2
0
    def _get_random_ribbon_graph(self):
        r"""
        Return a random ribbon graph with right parameters.
        """
        n = random.randint(self.min_num_seps,self.max_num_seps)
        S = SymmetricGroup(2*n)

        e = S([(2*i+1,2*i+2) for i in xrange(n)])
        f = S.random_element()
        P = PermutationGroup([e,f])

        while not P.is_transitive():
            f = S.random_element()
            P = PermutationGroup([e,f])

        return RibbonGraph(
                 edges=[e(i+1)-1 for i in xrange(2*n)],
                 faces=[f(i+1)-1 for i in xrange(2*n)])
示例#3
0
    def _get_random_cylinder_diagram(self):
        r"""
        Return a random cylinder diagram with right parameters
        """
        test = False
        while test:
            n = random.randint(self.min_num_seps,self.max_num_seps)
            S = SymmetricGroup(2*n)

            bot = S.random_element()
            b = [[i-1 for i in c] for c in bot.cycle_tuples(singletons=True)]

            p = Partitions(2*n,length=len(b)).random_element()
            top = S([i+1 for i in canonical_perm(p)])
            t = [[i-1 for i in c] for c in top.cycle_tuples(singletons=True)]
            prandom.shuffle(t)

            c = CylinderDiagram(zip(b,t))
            test = c.is_connected()

        return c
示例#4
0
    def _get_random_cylinder_diagram(self):
        r"""
        Return a random cylinder diagram with right parameters
        """
        test = False
        while test:
            n = random.randint(self.min_num_seps, self.max_num_seps)
            S = SymmetricGroup(2 * n)

            bot = S.random_element()
            b = [[i - 1 for i in c] for c in bot.cycle_tuples(singletons=True)]

            p = Partitions(2 * n, length=len(b)).random_element()
            top = S([i + 1 for i in canonical_perm(p)])
            t = [[i - 1 for i in c] for c in top.cycle_tuples(singletons=True)]
            prandom.shuffle(t)

            c = CylinderDiagram(zip(b, t))
            test = c.is_connected()

        return c