# 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


150  150   :meth:`CompleteBipartiteGraph <GraphGenerators.CompleteBipartiteGraph>` 
151  151   :meth:`CompleteGraph <GraphGenerators.CompleteGraph>` 
152  152   :meth:`CubeGraph <GraphGenerators.CubeGraph>` 
153    :meth:`FoldedCubeGraph <GraphGenerators.FoldedCubeGraph>` 
154  153   :meth:`FibonacciTree <GraphGenerators.FibonacciTree>` 
155  154   :meth:`FriendshipGraph <GraphGenerators.FriendshipGraph>` 
156  155   :meth:`FuzzyBallGraph <GraphGenerators.FuzzyBallGraph>` 
… 
… 

6111  6110  
6112  6111  return r 
6113  6112  
6114   def FoldedCubeGraph(self, n): 
6115   r""" 
6116   Returns the folded cube graph of order `2^{n1}`. 
6117   
6118   The folded cube graph on `2^{n1}` 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^{n1}` 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(n1) 
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   
6156  6113  def FriendshipGraph(self, n): 
6157  6114  r""" 
6158  6115  Returns the friendship graph `F_n`. 