# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1259504385 3600
# Node ID fb11b390bb2381eb9808ec664173f5187017b1b6
# Parent fee71ad457d0b6881f989cbe69b9bfe2eee0cd55
Dosctring in grqphs_generqtors.CubeGraph()
diff r fee71ad457d0 r fb11b390bb23 sage/graphs/graph_generators.py
a

b


2500  2500  return bipartite_graph.BipartiteGraph(G, pos=pos_dict, name="Complete bipartite graph") 
2501  2501  
2502  2502  def CubeGraph(self, n): 
2503   """ 
2504   AUTHORS: 
2505   
2506    Robert Miller 
2507   
2508   PLOTTING: See commented source code. 
2509   
2510   EXAMPLES: Plot several ncubes in a Sage Graphics Array 
2511   
2512   :: 
 2503  r""" 
 2504  Returns the hypercube in `n` dimensions. 
 2505  
 2506  The hypercube in `n` dimension is build upon the binary 
 2507  strings on `n` bits, two of them being adjacent if 
 2508  they differ in exactly one bit. Hence, the distance 
 2509  between two vertices in the hypercube is the Hamming 
 2510  distance. 
 2511  
 2512  EXAMPLES: 
 2513  
 2514  The distance between `0100110` and `1011010` is 
 2515  `5`, as expected :: 
 2516  
 2517  sage: g = graphs.CubeGraph(7) 
 2518  sage: g.distance('0100110','1011010') 
 2519  5 
 2520  
 2521  Plot several `n`cubes in a Sage Graphics Array :: 
2513  2522  
2514  2523  sage: g = [] 
2515  2524  sage: j = [] 
… 
… 

2526  2535  sage: G = sage.plot.plot.GraphicsArray(j) 
2527  2536  sage: G.show(figsize=[6,4]) # long time 
2528  2537  
2529   Use the plot options to display larger ncubes 
 2538  Use the plot options to display larger `n`cubes 
2530  2539  
2531  2540  :: 
2532  2541  
2533  2542  sage: g = graphs.CubeGraph(9) 
2534  2543  sage: g.show(figsize=[12,12],vertex_labels=False, vertex_size=20) # long time 
 2544  
 2545  AUTHORS: 
 2546  
 2547   Robert Miller 
2535  2548  """ 
2536  2549  from sage.rings.integer import Integer 
2537  2550  # generate vertex labels: 