Ticket #13862: trac_13862-unapply_13809.patch

File trac_13862-unapply_13809.patch, 2.3 KB (added by ncohen, 7 years ago)
  • sage/graphs/graph_generators.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1356731623 -3600
    # Node ID 51145c69b91006093210fdd8a455c61cce8e09c9
    # Parent  f55d59845a276d045f92132513e3a1ec7206e070
    A constructor for folded cube graphs -- unapply 13809
    
    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    150150- :meth:`CompleteBipartiteGraph <GraphGenerators.CompleteBipartiteGraph>`
    151151- :meth:`CompleteGraph <GraphGenerators.CompleteGraph>`
    152152- :meth:`CubeGraph <GraphGenerators.CubeGraph>`
    153 - :meth:`FoldedCubeGraph <GraphGenerators.FoldedCubeGraph>`
    154153- :meth:`FibonacciTree <GraphGenerators.FibonacciTree>`
    155154- :meth:`FriendshipGraph <GraphGenerators.FriendshipGraph>`
    156155- :meth:`FuzzyBallGraph <GraphGenerators.FuzzyBallGraph>`
     
    61116110
    61126111        return r
    61136112
    6114     def FoldedCubeGraph(self, n):
    6115         r"""
    6116         Returns the folded cube graph of order `2^{n-1}`.
    6117 
    6118         The folded cube graph on `2^{n-1}` vertices can be obtained from a cube
    6119         graph on `2^n` vertices by merging together opposed
    6120         vertices. Alternatively, it can be obtained from a cube graph on
    6121         `2^{n-1}` vertices by adding an edge between opposed vertices. This
    6122         second construction is the one produced by this method.
    6123 
    6124         For more information on folded cube graphs, see the corresponding
    6125         :wikipedia:`Wikipedia page <Folded_cube_graph>`.
    6126 
    6127         EXAMPLES:
    6128 
    6129         The folded cube graph of order five is the Clebsch graph::
    6130 
    6131             sage: fc = graphs.FoldedCubeGraph(5)
    6132             sage: clebsch = graphs.ClebschGraph()
    6133             sage: fc.is_isomorphic(clebsch)
    6134             True
    6135         """
    6136 
    6137         if n < 1:
    6138             raise ValueError("The value of n must be at least 2")
    6139 
    6140         g = self.CubeGraph(n-1)
    6141         g.name("Folded Cube Graph")
    6142 
    6143         # Complementing the binary word
    6144         def complement(x):
    6145             x = x.replace('0','a')
    6146             x = x.replace('1','0')
    6147             x = x.replace('a','1')
    6148             return x
    6149 
    6150         for x in g:
    6151             if x[0] == '0':
    6152                 g.add_edge(x,complement(x))
    6153 
    6154         return g
    6155 
    61566113    def FriendshipGraph(self, n):
    61576114        r"""
    61586115        Returns the friendship graph `F_n`.